Hello I'm new here! I just wanted to ask, how can I go back to Main menu using this code that I have made (I know it's not yet finish but please help me T^T)
I'm using Visual Studio c++ 2010! :)
I there are any errors in my codes or if you have suggestion, i would gladly accept your comments! ^_^
Project: Computer Shop System
#include <iostream>
#include <string>
using namespace std;
int pcnum[5],x; //choice pc
int pc;
int i; //name
int y; //hours
int p;//price
int yes=1;
int no=0;
int l; // Do you wish to login or logout?
struct customer{ //void user data
char name [50][50];
int hrs[50];
float price [50];
}data;
void UserData();
int main (){
cout<<"\t\t===================================="<<endl;
cout<<"\t\t************************************"<<endl<<endl;
cout<<"\t\t WELCOME TO KIMNIC COMPUTER SHOP!"<<endl<<endl;
cout<<"\t\t************************************"<<endl;
cout<<"\t\t===================================="<<endl;
cout<<"Choose the available PCs:"<<endl;
cout<<"[1]PC1 \n[2]PC2 \n[3]PC3 \n[4]PC4 \n[5]PC5";
cout<<"\n------------------------------------"<<endl;
cout<<"\nEnter your choice: ";
cin>>pcnum[x];
switch (pcnum[x]){
case 1:
cout<<"\nWELCOME TO PC#1!!!"<<endl;
UserData ();
break;
case 2:
cout<<"\nWELCOME TO PC#2!!!"<<endl;
break;
case 3:
cout<<"\nWELCOME TO PC#3!!!"<<endl;
break;
case 4:
cout<<"\nWELCOME TO PC#4!!!"<<endl;
break;
case 5:
cout<<"\nWELCOME TO PC#5!!!"<<endl;
break;
case 6:
exit (1);
break;
}
system ("pause>0");
}
void UserData(){
cout<<"\nTYPE: \n[1]-For Login \n[0]-For Logout"<<endl;
cout<<"\n================\n";
cout<<"Do you wish to Login of Logout? ";
cin>>l;
if (l==0){
cout<<"\nThank you and come again!!";
}
else{
pcnum[x];
cout<<"You have chosen: "<<pcnum[x];
cout<<"\nNickname: ";
//cin>>data.name[i],50;
cin.getline(data.name[i],50);
cout<<"No. of hours: ";
cin>> data.hrs[y];
cout<<"Price: ";
cin>> data.price[p];