C++ Race Car Homework Problem

Hi!

Hope everyone is fine. I am student of C++ and for intro to C++ subject ,I am doing some work on homework problem. I am facing a problem at the end of the code.
The assignment is here:
Starter
Work on designing simulator of a race car. The race car has to drive over a direct track which has 100 meters length. Having a speed of 0 m/s race car will begin the driving. Program will get three inputs which will be different, these inputs will have an effect on car speed.
Move:
The input will instruct the simulator aout X seconds to move the car at current speed. Where numerical value is X following string move directly.
Accelerate:
Following formula  newspeed = currentspeed+y where numerical value is y which follows accelerate move directly, input make current speed faster.
Decelerate: Following formula newspeed = currentpseed-z where numerical value is z which follows decelerate move directly, this input make lower current speed of race car.
Ending instruction: https://www.theengineeringprojects.com/2019/12/how-to-include-bootstrap-in-asp-net-core.html
Using values of an acceleration or deceleration or value of time I have to input every command to make move. The format is below:
Accelerate 2 Move 5 , with Accelerate 1 Move 1 , having Decelerate 3 Accelerate 10 Move 20
Then the number of seconds gets output. But I am facing some issues in getting out second’s value to be the number of seconds that it took for 100 meter track.
Any one has any idea about this then let me know.

Thanks
Last edited on
3 for 3 on the zero initial effort.
https://www.cplusplus.com/forum/beginner/280173/
https://www.cplusplus.com/forum/beginner/280739/

You may as well drop the course at this point, you're simply not motivated enough.

At least it will save someone the trouble of having to fire your lazy ass if you manage to cheat your way through college and into a job.
Well what you have attempted so far. What design have you done? What don't you understand? What are you having trouble with?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//  Thanks to furry guy for this
#include <iostream>
#include <cctype>
#include <limits>

int main()
{
   std::cout << "Do you want someone to do all the work for you? ";
   char answer { };
   std::cin >> answer;

   std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');

   if (::toupper(answer) == 'Y' ) { std::cout << "Post it in the Jobs section.\n"; }

   else { std::cout << "Show what you have coded so far.\n"; }

   std::cout << "Good luck.\n";
}

Topic archived. No new replies allowed.