Write a program that uses recursion to determine one age

Assignment Help C/C++ Programming
Reference no: EM131065457

1. Write a program that uses recursion to determine one's age. The user will enter the current year and the year they were born (birth year) from the keyboard. The program will output the current age of the user. Check positive and zero cases only. A recursive function must be used for full credit. No recursive helper functions may be used as well. Output should be user friendly.

Name the program:
TestRecAgeXX.cpp, where XX are your initials.

2. The two sets of output below show the results of successive circular rotations of a vector. One set of data is for a vector of integers, and the second is for a vector of strings.

1  3  5  7

3  5  7  1

5  7  1  3

7  1  3  5

a  b  c  d  e

b  c  d  e  a

c  d  e  a  b

d  e  a  b  c

e  a  b  c  d

Write two template functions that can be used to rotate and output a vector of a generic type:

void rotateLeft(vector <T>& v)
void output(vector <T> v)

The first function performs a single circular left rotation on a vector, and the second prints out the vector passed to it as a parameter. Write a test program that will test the two functions by generating output similar to above. Use element types of int,double,char and string. Must use templates and function headers above for full credit. Use C++ string class. Output should look similar to the text.

Name the program:
TestRotateTemplateXX.cpp, where XX are your initials.

Reference no: EM131065457

Questions Cloud

-what is the probability that demand will exceed 1000 pounds : -What is the probability that demand will exceed 1000 pounds?
What is the probability that at least one line stalls : What is the probability that at least one line stalls at least once in any given week?
How much interest will cooper have earned after 6 months : How much interest will Cooper have earned after 6 months?ste your question here...
A leader acting in an unethical manner : Without including names, describe a situation in which you have witnessed a leader acting in an unethical manner. What effect did the leader's actions have on organizational or team proformance?
Write a program that uses recursion to determine one age : Write a program that uses recursion to determine one's age. The user will enter the current year and the year they were born (birth year) from the keyboard. The program will output the current age of the user. Check positive and zero cases only.
Calculate a confidence interval under the full factorial : Assuming a 5% reactivation rate, calculate a confidence interval under the full factorial, as well as the reduced factorial design (your matrix A and Matrix B above) and discuss the difference in precision or the width of the confidence interval.
Write a reservation system for an airline flight : Write a reservation system for an airline flight. Assume the airplane has 10 rows with 4 seats in each row. Use a two dimensional array of strings to maintain a seating chart. In addition create a array to be used as a waiting list in case the pla..
Determine the approximate number of american adults : determine the approximate number of American adults who would find giving up their phone more difficult than giving up their partner. Approximately nothing American adults who would find giving up their phone more difficult than giving up their pa..
Analyze the significance of the concept of leadership : 1. Analyze the significance of the concept of leadership and the different leadership styles. 4. Illustrate the role of ethics and values in guiding organizational behavior.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Implementation of sorting technique

Implementation of sorting technique

  Extend the definition of the class clocktype by overloading

a. Extend the definition of the class clockType by overloading the post-increment operator function as a member of the class clockType

  Boolean variable

Suggest one (1) example of a problematic programming situation or scenario that a Boolean variable could at least partially resolve. Justify your response

  Write a marie program

Write a Marie program - Given a numbers in memory, labelled V, reverse its sign - You can halt your program once the Result is determined.

  Write two short c programs and solve four exam-style

write two short c programs and solve four exam-style problems. details on the programs are as follows.program

  Write a function that compares two stacks for equality

Write a function that compares two stacks for equality. The function takes two stacks as parameters and returns true if they are identical.  The stacks should remain unchanged after the function returns to the calling program.

  Microsoft project file work breakdown structure

Update the Microsoft Project file you created in (Work Breakdown Structure) with the following changes.

  Write a program that sorts a linked list

Write a program that sorts a linked list of integers using merge sort. the program will read the integers froma file onto a linked list and then sort the linked list using MERGE SORT. this will require additional linked lists but you should use li..

  Demonstrate the construction and output of an array

In fluid mechanics, the Reynolds number (Re) is a dimensionless quantity that is used to help predict similar flow patterns in different fluid flow situations. For example, Reynolds numbers can be computed for different velocities of fluid flow over ..

  Write the code for the for-loop initializations

Write the code for the for-loop initializations and the for-loop body. Carefully study and compare the pseudocode and C++ for loops in the commentary.

  Analyze an efficient function for removing all duplicates

Describe and analyze an efficient function for removing all duplicates from a collection A of n elements.

  Find out if damjibhai can win

Once a jewel type is removed from the necklace, all other instances of the same jewel type is treated as polished by the person who removed the jewel

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd