I'm trying to do a project for school, and I'm a little stuck. I have to simulate gas consumption of a car on a road trip under different scenarios (e.g.: weather conditions, road conditions, time of day, location etc.), with each scenario in its own function, and calling the function from the main function. Part of what I have is something like this:
Select road condition (1) Flat (2) Gravelly (3) Hilly:
Then the user will type either 1, 2, or 3 to indicate the condition they want to select. The problem is, I have no idea how I should call the user input to the main function, and then display the results of each scenario and how that affects the gas consumption at the end when the user input is completed. I was thinking of using pointers to call the user input to the main function, and using if else statements for each condition, e.g.:
1 2 3 4
|
if (roadCond == 1)
{
cout << "You selected: Flat road.";
}
|
But I am completely stuck.
Anyways, any help would be greatly appreciated. I've done a lot of Googling, but I can't seem to find a solution (or at least a solution that I have been taught).