I am in a beginning programming class, and am having all these syntax errors that i can't fiugre out. Please help!
/#include <cstdio> //Header Files
#include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;
int main();
int init_function();
enum choice {regular=1, super, superdooper,quit};
choice display_function();
int big_switch();
int calculate(int ,int);
int calculate(int);
int superdooper_loop(int);
int superdooper_calculate(int, char);
void quit_pattern();
void grand_total(int);
static int rand_number;
/************************************************************************************************
MAIN
purpose:
input:
returns:
************************************************************************************************/
int main (){
bool notValid;
enum choice{regular=1, super=2, superdooper=3,quit=4};
int age;
display_function();
do{ //Validation for age
notValid=false;
printf ("\nHow old are you?");
cin >> age;
if (age<1 || age>115)
{
cout << "Invalid entry.\n";
notValid=true;
}
} while (notValid);
int big_switch();
}
/************************************************************************************************
INIT
purpose:
input:
returns:
************************************************************************************************/
int init_function(){
int rand_number = rand();
return(rand_number);
}
/************************************************************************************************
DISPLAY
purpose: displays menu
input: choice
returns: choice
************************************************************************************************/
choice display_function (){
enum choice {regular=1, super=2, superdooper=3,quit=4};
cout << "Welcome to the Fair Price Car Wash\n\n";
cout << "1) Regular Car Wash\n";
cout << "2) Super Car Wash\n";
cout << "3) SuperDooper Car Wash\n";
cout << "4) Quit\n\n\n";
cout << "Select one of the options:";
cin >> choice;
return(choice);
}
/************************************************************************************************
BIG SWITCH
purpose:
input: choice
returns:
************************************************************************************************/
int big_switch(choice){
int passengers, age;
bool notValid;
switch (choice){
case (regular):
int calculate(int age, int number_pass);
break;
case (super):
int calculate(int age);
break;
case (superdooper):
do{
notValid=false; //Valioating for >4 passengers
cout << "\nHow many passengers do you have?";
cin >> passengers;
if (passengers >=4)
{
cout << "Invalid entry.";
notValid=true;
}
}while (notValid);
int superdooper_loop();
break;
case (quit):
int quit_pattern();
void grand_total();
break;
else
cout << "Please enter a valid selection.";
}
/************************************************************************************************
REG CALCULATE
purpose: calculates price for regular
input: number of passengers
returns:
************************************************************************************************/
int calculate(age, passengers){
if (passengers>3)
{
fee=passengers*age;
grandtotal=grandtotal+fee; //Calculating price for #1
printf ("%30s","The price for you is $");
printf ("%-5.2lf", fee);
cout << "\n\n";
printf ("%30s","The grand total is $");
printf ("%-5.2lf\n", grandtotal);
}
else
{
for(a=0;a<passengers;a++) //Display as many starts as the number of passengers
cout << "*\n";
grandtotal=grandtotal+fee;
printf ("%30s","The price for you is $");
printf ("%-5.2lf", fee);
cout << "\n\n";
printf ("%30s","The grand total is $");
printf ("%-5.2lf""\n", grandtotal);
}
void grand_total();
cout << "The fee is: ", fee;
}
/************************************************************************************************
SUPER CALCULATE
purpose: calculate sproce for super
input:
returns:
************************************************************************************************/
int calculate(int){
double fee;
int age;
double grandtotal=grandtotal+fee; //Calculating price for #2
if (age>=65)
{
fee=(age-65)*.5;
printf ("%30s","The price for you is $");
printf ("%-5.2lf", fee);
cout << "\n\n";
}
else if(age% 2 == 0)
cout << "\nNo Charge\n";
else
{
fee=age;
grandtotal=grandtotal+fee;
printf ("%30s","The price for you is $");
printf ("%-5.2lf", fee);
printf ("%30s","The grand total is $");
printf ("%-5.2lf\n", grandtotal);
cout << "\n\n";
}
void grand_total();
cout << "The fee is: ", fee;
}
/************************************************************************************************
SUPER DOOPER LOOP
purpose: gets age, gender of passengers
input: number of passengers
returns:
************************************************************************************************/
int superdooper_loop(){
int a, passage, passengers;
char passgend;
for (a=1;a<passengers;a++) //Loop for passengers' ages and genders
{
cout << "\nEnter gender of passenger number ";
cout << a, ":";
cin >> passgend;
cout << "\nEnter age of passenger number ";
cout << a, ":";
cin >> passage;
}
int superdooper_calculate(a, passage);
}
/************************************************************************************************
SUPER DOOPER CALCULATE
purpose: calculates fee for option 3
input: ages, genders
returns:
************************************************************************************************/
int superdooper_calculate(int passage, int age, char passgend){
int passage, age;
char f;
double fee, grandtotal;
char passgend;
if (passgend=='f') //Calculating for f passenger
{
fee=passage*1.5;
grandtotal=grandtotal+fee;
printf ("%30s","The price for you is $");
printf ("%-5.2lf", fee);
printf ("%30s","The grand total is $");
printf ("%-5.2lf\n", grandtotal);
cout << "\n\n";
}
else //Calculating for f passenger
{
fee=2*age;
grandtotal=grandtotal+fee;
printf ("%30s","The price for you is $");
printf ("%-5.2lf", fee);
printf ("%30s","The grand total is $");
printf ("%-5.2lf\n", grandtotal);
cout << "\n\n";
}
void grand_total();
cout << "The fee is: ", fee;
}
/************************************************************************************************
QUIT PATTERN
purpose: displays star pattern
input: none
returns: none
************************************************************************************************/
int quit_pattern(){
int row, space, asterisk;
for(row=1; row<5; row++)
{
for(space=0; space>4+row; space++)
printf (" ");
for(asterisk=1; asterisk<=2*row; asterisk++) //Displaying stars
printf("*");
cout << endl;
}
}
/************************************************************************************************
GRAND TOTAL
purpose: displays grand total
input: random number
returns:
************************************************************************************************/
void grand_total(){
static int rand_number;
int fee;
rand_number=init_function();
double grandtotal=fee+rand_number;
cout << "The grand total is :", grandtotal;
}
}
Errors:
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp" -o "C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp: In function `choice display_function()':
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:77: error: expected primary-expression before ';' token
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:78: error: expected primary-expression before ')' token
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp: In function `int big_switch(choice)':
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:89: error: expected primary-expression before ')' token
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:113: error: expected primary-expression before "else"
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:113: error: expected `;' before "else"
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:122: error: initializer expression list treated as compound expression
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:122: error: expected `,' or `;' before '{' token
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:153: error: expected primary-expression before "int"
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:153: error: expected `;' before "int"
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:186: error: expected primary-expression before "int"
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:186: error: expected `;' before "int"
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:206: error: a function-definition is not allowed here before '{' token
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:206: error: expected `,' or `;' before '{' token
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:241: error: expected primary-expression before "int"
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:241: error: expected `;' before "int"
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:258: error: expected primary-expression before "void"
C:\Documents and Settings\Compaq_Owner\Desktop\assignment 4 prototype.cpp:258: error: expected `;' before "void"
Execution terminated