I NEED HELP QUICK. DUE BY MIDNIGHT TONIGHT!!

I NEED HELP QUICK. I need help with this assignment, it's due by midnight. This is what i have to do: In addition to the existing main() function you will have three user-defined functions. These functions must be defined AFTER the main() function. That means you must use a function prototype for each function you create. Here is the breakdown of the required functions:
A void function that will display the opening menu.
A void function that will display the time periods menu.
A value-returning function that will get a valid number from the user. This function should be reused for the Main Menu, Month, Day and Time Periods. You can use it for the year if you want to give a span for the number of years, but it is not required. It must validate it to make sure it is a number between the possible options. If the entry is not correct, it must loop until a correct option is entered.
The time machine program should work as before, the only difference is now it will use the three user-defined functions you will create.
This is what i have. Please help quickly.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
  #include "stdafx.h"
#include "conio.h";
#include "iostream";
#include "string";
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	
	int choice;
	char name[20];

	string months[12]= {"January" , "Febaurary" , "March" , "April" , "May" , "June" , "July" , "August" , "September" , "October" , "November" , "December" };
	
	
	
	

	cout<<"Welcome to the Time Machine "<<endl;
	cout<<"What is you name ?"<<endl;
	cin>>name;
	cout<<"welcome "<< name <<endl;
	cout<<"\n";
	cout<<"1- Enter a specific date"<<endl;
	cout<<"2. Select a Time Period"<<endl;
	cout<<"3. Wildcard - I'm Feeling Lucky"<<endl;
	cin>>choice;

	if(choice == 1)
	{
		int month;
		int day;
		int year;

		cout<<"What is the month? (enter 1-12)"<<endl;
		cin>>month;

		cout<<"What is the day? (enter 1-31)"<<endl;
		cin>>day;

		cout<<"What is the year?"<<endl;
		cin>>year;
		cout<<"OK we will send you to "<<months[month-1]<<"/"<<day<<"/"<<year<<endl;
		cout<<"\n";
		cout<<"Ok Ending the time machine program";
	}
	else if(choice == 2)
	{
		int tperiod_choice;
		cout<<"\n";
		cout<<"Choose from one of these time periods."<<endl;
		cout<<"\n";
		cout<<"1. Prehistoric Dinosaur Era"<<endl;
		cout<<"2. 500 BC"<<endl;
		cout<<"3. Renaissance"<<endl;
		cout<<"3. Renaissance"<<endl;
		cout<<"4. American Civil War"<<endl;

		cin>>tperiod_choice;
		cout<<"\n";
		cout<<"Ok We will send you to choice "<<tperiod_choice<<endl;

	}
	else if(choice == 3)
	{
		cout<<"\n";
		cout<<"Ok i will choose where to send you"<<endl;
	}

	else
	{
		cout<<"your choice is not valid"<<endl;
	}

	getch(); 
	return 0;
}
What exactly do you need help with?

Anyways, you should try to follow the instructions and write the 3 functions you were told instead of putting everything in main. It makes it much clearer to read.

As per your instructions, you'll want to declare the function prototypes before your main function:
1
2
3
void openingMenu();
void timePeriodsMenu();
int getValue( int lowerBound, int upperBound, istream &in = cin);


The above code is a possible choice for the function prototypes, though you can probably do without specifying the input stream.
i'm new to programming. I need help with where would i place that code you gave me. I don't understand the instructions.
Those were function prototypes. They're basically there to tell your compiler those functions exist so they can be used. You the have to define them later in the file. Therefore, they'll go right after your preprocessor commands (#include) and your using namespace std;.

Do note you still have to define (write all the code for) the functions though.

For openMenu(), the relevant code in main would be lines 19-27. For void timePeriodsMenu();, the relevant code would be 49-61. Just copy the code into your new function definitions and make the necessary changes.
Last edited on
thank you so much
Topic archived. No new replies allowed.