e6390af40fd246928c9f6b67562cf0fa37712fa8

6/10/2018

Parking Project in C++ Using Structure

In this project there is a Parking Area and they can park maximum 50 vehicles in this area. The vehicles are Car, Bus and Rikshaw. The total amount is counted when the vehicle is enter into to the parking area..The Rikshaw will charged 100 rupees, car will charged 200 rupees and bus will charged 300 rupees.You can also change their values.


#include <iostream>
using namespace std;

struct Parking
{
    int total;
    int riksha;
    int bus;
    int car;

};

void show(struct Parking p1){

cout << "\n\n!!!!!!!!!! Your Recored is Here!!!!!!!!!!!!!\n\n" << endl;
cout << "Total No of Rikshaws : " << p1.riksha<< endl;
cout <<" Total No of Cars : " << p1.car << endl;
cout << "Total No of Buses  :" << p1.bus<<endl;
cout << "Total Income of Today  :" << p1.total<<endl;

  cout << "\n\n!!!!!!!!!! Thanks :) !!!!!!!!!!!!!\n\n" << endl;
}

int main()
{
int count=0;
int r=0,c=0,b=0,t=0;
struct Parking p1;
char exit;
int user;
p1.bus=0;
p1.car=0;
p1.riksha=0;
p1.total=0;


do{

cout<<"Enter 1 for Riksha"<<endl;
cout<<"Enter 2 for Car"<<endl;
cout<<"Enter 3 for Bus"<<endl;
cout<<"Enter 4 for Show Recored"<<endl;
cout<<"Enter 5 for Delete Record"<<endl;

do{
cout<<"\nEnter Your Choice"<<endl;
cin>>user;
if(user==1){
system("Color f2");
cout<<"You Parked Rikshaw and charged 100 Rupees\n"<<endl;
r=r+1;
p1.riksha=r;
t=t+100;
p1.total=t;
count++;
}
else if(user==2){
system("Color d2");
cout<<"You Parked Car and charges 200 Rupees"<<endl;
c=c+1;
p1.car=c;
t=t+200;
p1.total=t;
count++;
}
else if(user==3){
system("Color a4");
cout<<"You Parked Bus and charged 300 Rupees"<<endl;
b=b+1;
p1.bus=b;
t=t+300;
p1.total=t;
count++;
}
else if(user==4){
system("color b4");
show(p1);
}
else if(user==5){
p1.bus=0;
p1.car=0;
p1.riksha=0;
p1.total=0;
cout<<"Record deleted"<<endl;
system("Color c6");
}
else{
cout<<"Wrong Input"<<endl;
}

}while (count<5);//inner do while


cout<<"Press y to continue program and n to close..."<<endl;
cin>>exit;

}while(exit!='n'); ///outer do while

    return 0;
}

No comments:

Post a Comment

Privacy Policy for Apps

Privacy Policy Muhammad Shahbaz built the Health Physio Association app as a Free app. This SERVICE is provided by Muhammad Shahbaz at no...