Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by nana1201

  1. error C2050: switch expression not integral error C2061: syntax error : identifier payment #include<iostream> #include<ctype.h> #include<string.h> #include<windows.h> #include<ctime> using namespace std; int n; struct tm *ptr; //strucure and pointer for displaying the operating system time time_t lt; void fitness(); //function for fitness void calorie(); //function for calorie section void exercise(); //function for exercise section void facilities(); //function for facilities section void time_3D(void); //function for time void return_back(); //function to step back to menu void quit_system();//function for quit from the programme void registration();//function for registration section void BMI();//function for BMIr section void reservation(); //function for reservation section void welcome_screen(); //function for appear welcome void selectFromMenu(); //function for our menu void payment(); //function for payment int choice; //variable to choosing int cls; void main(void) { lt=time(NULL); ptr=localtime(&lt); welcome_screen(); //calls function which displays the welcome screen selectFromMenu(); //calls the function for the main menu } void selectFromMenu() //calls the function for the main menu { system("cls");//clears the screen cout<<"\n\t\tTODAY'S TIME AND DATE:"<<asctime(ptr)<<endl; //displays the system time and date cout<<"\n\n\t - - - - - - - - - - INFORMATION OF SEHAT ALWAYS FITNESS - - - - - - - \n"; cout<<"\n\t* *\n"; cout<<"\n\t* OPENING HOURS *\n"; cout<<"\n\t* MONDAY-FRIDAY :9.00 AM TO 9.00 PM *\n"; cout<<"\n\t* SATURDAY-SUNDAY:9.00 AM TO 2.00 PM *\n"; cout<<"\n\t* PUBLIC HOLIDAY :AS ADVISED *\n"; cout<<"\n\t* *\n"; cout<<"\n\t* ADDRESS *\n"; cout<<"\n\t* LOT 1C,JALAN SEGAMBUT,TUNKU SYED,101010,PERWIRA,NAKADNAS *\n"; cout<<"\n\t* FACILITIES *\n"; cout<<"\n\t* 1 Fitness Plan *\n"; cout<<"\n\t* 2 Calorie Burning *\n"; cout<<"\n\t* 3 Type of exercise *\n"; cout<<"\n\t* *\n"; cout<<"\n\t* *\n"; cout<<"\n\t* NO CONTACT:0123456789 *\n"; cout<<endl; cout<<"\n\n\t - - - - - - - - - - MAIN MENU - - - - - - - \n"; cout<<"\n\t* *\n"; cout<<"\n\t* PRESS: *\n"; cout<<"\n\t* 1-registration press-->1 *\n"; cout<<"\n\t* 2-BMI press-->2 *\n"; cout<<"\n\t* 3-reservation press-->3 *\n"; cout<<"\n\t* 4-facilities press-->4 *\n"; cout<<"\n\t* 5-quit press-->5 *\n"; cout<<"\n\t---------------------------------------------------"<<endl ; cout<<"\n\n PLEASE ENTER YOUR CHOICE:"; cin >>"choice"; //reads the selection and assigns it to a variable switch("choice") { case 1: system("cls"); cout<<"registration()";//function call for registration function break; case 2: system("cls"); cout<<"BMI()"; //function call for BMI function break; case 3: system("cls"); cout<<"reservation()";//function call for reservation break; case 4: system("cls"); cout<<"facilities()"; break; case 5: system("cls"); cout<<"quit_system ()"; break; default: { cout<<"ERROR!INVALID SELECTION\n"; cout<<"PLEASE RE-ENTER\n"<<endl; selectFromMenu(); } } } void registration() { { char person_name[50]; char buffer[50]; char ic_num[50]; char tel_num[50]; char gender[4]; char age[4]; cout <<"\n\t\t******WELCOME TO SEHAT ALWAYS FITNESS CENTRE*******\n"<<endl; cout<<"enter your name : "; cin.getline (person_name,50); cin.getline(buffer,50); cout<<"\nenter your IC NO : "; cin >> ic_num; cout<<"\nenter your telephone no : "; cin>>tel_num; cout<<"\nenter M for male, F for female\n"; cout<<"enter your gender : "; cin>>gender; cout<<"\nenter your age : "; cin>>age; cout<<endl; return_back(); } BMI(); { double BMI; float weight, height; float weight_kg; float height_m; //prompt and read the value of weight(in kg) and height (in cm) k:; cout<<"enter your weight_kg and height_m:"; cin>>weight_kg>>height_m; //determine whether any weight or height has zero or negative value if(weight_kg<0||height_m<0){ cout<<"enter correctly "; goto k;} //repeat selection if the user enter the wrong arrangement { //prompt and read the value of weight(in kg)and height(in cm) BMI = weight / (height * height); cout << "\nBMI's : " << BMI << endl; if (BMI<=18.5){ cout << "\n\t\t\tYou were UNDERWEIGHT!"<<endl;} else if (BMI>=30.0){ cout << "\n\t\t\tYou were OBESE!"<<endl;} else if (BMI<30.0 && BMI>=25.0 ){ cout << "\n\t\t\tYou were OVERWEIGHT!"<<endl;} else if(BMI>18.5 && BMI<25.0){ cout << "\n\t\t\tYou were FIT"<<endl; cout<<"\n\n\n"; return_back(); } } } void reservation(); } void reservation(int) { int day; int month; int year; int hours; do { cout<<"\nEnter the date you want to reserve our centre"<<endl; cout<<"\nday :"; cin>>day; if (day > 31 || day < 0) //Determine whether user enter wrong day { cout<<"\nplease enter the correct date"<<endl; } } while (day < 31); do { cout<<"\tmonth:"; cin>>month; if (month > 12 || month < 0) //Determine whether user enter wrong month cout<<"\nPlease enter the correct month"<<endl; } while (month < 12); do { cout<<"\tyear :"<<endl; cin>>year; cout<<"\nHow long do you want to reserve our centre?(in hours)"<<endl; cin>>hours; cout<<"\n\t\t\tYOU ALREADY MAKE A RESERVATION."<<endl; if (year < 2010 ) cout<<"\nPlease enter the correct year"<<endl; } payment() } void fitness() { cout << "Your fitness Journey starting from :\n"<<endl; cout << "\tA 60 minutes appointment with a qualified fitness team\n\n"; cout << "\t*********************************************************\n\n"; cout << "\t\tTake measurements whole body\n"; cout << "\t*********************************************************\n\n"; cout << "\t\tProvide customer with unique programme\n"; cout << "\t*********************************************************\n\n"; cout << "\t\tOffer customer nutritional support\n"; cout << "\t*********************************************************\n"; selectFromMenu(); } void calorie() { cout << "\nnasi lemak : carbs, 232.8g | fat, 117.9g | protein, 38.80g\n"; cout << "\nroti canai : carbs, 182.0g | fat, 92.70g | protein, 26.80g\n"; cout << "\nfried mee : carbs, 162.4g | fat, 81.00g | protein, 37.60g\n"; cout << "\nchicken : | fat, 807.3g | protein, 486.8g\n"; cout << "\nwedges : carbs, 112.0g | fat, 117.0g | protein, 20.00g\n"; selectFromMenu(); } void exercise() { cout << "1. Aerobic Exercise"<<endl; cout << "2. Flexibility Exercise"<<endl; cout << "3. Strength Training"<<endl; selectFromMenu(); } void payment() { float hours,payment,y,account_number; cout<<"Please make a payment."<<endl; cout<<"Insert the hour of the session."<<endl; cin >>hours; payment=hours*5; cout<<"\nyour payment is RM"<<payment<<endl; cout<<"\nDo you want to pay by using banking online now?\npress 1 for yes....2 for no :"; cin>>y; if(y==1) { cout<<" Enter your account number : "; cin >>account_number; cout<<"\n\t\t\tYour payment have been settle.Thank you."<<endl; } else { cout<<"\nYou must pay the bill within 3 days from now."<<endl; cout<<"if not,your reservation will be cancelled."<<endl; } } void facilities(int) { int a; do { // Prompt and Read the number user prefer cout << "What facilities do you prefer ?"<<endl; cout << "1 Fitness Plan" << endl; cout << "2 Calorie Burning" << endl; cout << "3 Type of exercise" << endl; cin>>a; if (a == 1) fitness();//Call function fitness else if (a == 2) calorie();//Call function calorie else if (a == 3) exercise();//Call function exercise else cout << " Wrong selection and Enter the correct number.!"<<endl; } while ( a!=1||a!=2||a!=3); } void quit_system () { system("cls"); cout<<"\n\t\tTODAY'S TIME AND DATE:\n"<< asctime(ptr)<<endl; cout<<"\n\n"; cout<<"\n\t* THANKS for using our online servise>>>>"; cout<<'.'; system("exist"); } void welcome_screen() { system("cls"); cout<<"\n\t\tTODAY'S TIME AND DATE:"<<asctime(ptr)<<endl; cout<<"\n\n"; cout<<"\t W W EEEEEE L CCCCC OOOOO M M EEEEEE\n"<< "\t W W W E L C O O MM MM E \n"<< "\t W W W W EEEE L C O O M M M M EEEE \n"<< "\t WW WW E L C O O M M M E \n"<< "\t W WW EEEEEE LLLLLL CCCCC OOOOO M M EEEEEE\n"<<endl; cout<<"\n\n\t\t RESERVATION SYSTEM online \n"; for(int i=0;i<=40;i++) { Sleep(200); cout<<">"; } }
  • Create New...