Hello friends, I terribly need help doing this c++ assignment, I try hard to do but I couldn't do it.. If anyone from sajha sathi do it for me will be highly appriciated. Thank you advance... and my questions are as follows..
1)(Based on Gaddis textbook page 237 Programming Challenges question 14)
Write a program that asks the names of three runners and the time it took each of them to finish a race as integers.The program should display who came in first, second and third place.
Input Validation:Only accept positive numbers for the times.
Hint:Suggest using cin.getline( name, 81) to get the names and to use cin.getline(time, 30) with atoi(time); to convert to an int.Refer to example for help here:
Sample of the code/output
Enter the names of three runners and their finishing times.
I will tell you who came in first, second, and third.
Name of Runner 1: Terry
Runner 1's finishing time: 21
Name of Runner 2: Brad
Runner 2's finishing time: 18
Name of Runner 3: Michelle
Runner 3's finishing time: 19
Brad came in first place.
Michelle came in second place.
Terry came in third place.
2. (Based on Gaddis textbook page 292 Programming Challenges question 8 math tutor)This program started in Programming Challenge 15 of Chapter 3 and was modified in the Programming Challenge 9 of Chapter 4. (Basically this is a math tutor for students that randomly asks math questions, waits for user evaluation and then gives the answer.
Do all the above and then modify the program again so it display a menu allowing the user to select an addition, subtraction, multiplication or division problem.The final selection on the menu should let the user quit the program.After the user has finished the Math problem, the program should display the menu again.This process is repeated until the user chooses to quit the program.
Input Validation: If the user selects an item not on the menu , display an error message and display the menu again. Example output proof:
Menu
1. Addition problem
2. Subtraction problem
3. Multiplication problem
4. Division problem
5. Quit this program
Enter your choice (1-5): 4
6 / 1 = 6
Congratulations! That's right.
Menu
1. Addition problem
2. Subtraction problem
3. Multiplication problem
4. Division problem
5. Quit this program
Enter your choice (1-5): 8
The valid choices are 1, 2, 3, 4, and 5. Please choose: 5
Dude, I can also help you on this, but I don't want to provide you line by line code.. as you have mentioned you try hard and unable to do it. Can you mentioned what was problem you faced and how much you succeed. Then based upon that I will try to give you a feedback.
Also let me know how much of knowledge you have in C++. As "wai_wai" mentioned, you can use hash table and dictionary to work this program, but those will be little bit complicated. But as you are not experienced you can use simple array
This is how you should implement (in the simplest form) Step 1: At first just write simple program which will accpe the number and name and try to see valdiation is working or not
Step 2: declare 2 array of size 3 to store time and name. Try to figure out the which time is the smallest one, based upon that print the result
IF you are interested then I can suggest the flow for second question in same way
Homeland Security revokes temporary status for 532,000 Cubans, Haitians, Nicaraguans and Venezuelans
TPS to F1 Status.
Nepal TPS has been Extended !!!
Got my F1 reinstatement approved within 3 months(was out of F1 for almost 2 years)
ICE kidnapping people off the streets over op eds
TPS of Nepal to be automatically extended for 6 months based on South Sudan decision
Nepal TPS decision
Has anyone here successfully reinstated to F-1 status after a year-long gap following a drop from F-1?
US citizen Petitioning my wife who was out of status when she was in H1B. What to do ?
TPS Sakiyo Tara Case is in Court.
Supreme Court allows Trump to end TPS for Venezuelans
#MAGA#FAFO is delicious
Genuine Question.... Why so many folks still in TPS after 10 years. Is the statistics wrong?
What is the purpose of an F1 student visa in the U.S.?
Any input on remote jobs(IT related or Sales or Marketing)?
Nepal Likely to Get 60-Day TPS Notice
मुद्दा हाल्छन होला र ?
TPS cancel bho bhane k garne?
NOTE: The opinions
here represent the opinions of the individual posters, and not of Sajha.com.
It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address
if you want any posting to be considered for deletion. Your request will be
handled on a one to one basis. Sajha.com is a service please don't abuse it.
- Thanks.