Car rental small project in C++. Copy code and get result.
#include <iostream>
#include <conio>
#include <cstring>
#include <stdlib>
#include <math.h>
struct car
{
string car;
int rentpr;
int rentprice;
int carno;
int quan;
string customer;
string id;
int ava;
int total;
};
void main()
{
car c;
cout<<"__________________WELCOME TO CAR RENTAL CENTER__________________"<<endl;
cout<<"\tCustomer Detail"<<endl;
cout<<"Enter Your Name"<<endl;
cin>>c.customer;
cout<<"Enter your ID"<<endl;
cin>>c.id;
clrscr();
cout<<"The list of Available cars are following"<<endl;
cout<<" Carname\tModelno\t\tcarno\tTotal\t\tRent"<<endl;
cout<<" Pajero Mitsubishi(2015)1123\t20\t\t5000(perday) "<<endl;
cout<<" Mehran Suzuki(2015)\t1124\t10\t\t3500(perday)"<<endl;
cout<<" Corolla Altis(2015)\t1125\t15\t\t4500(perday)"<<endl;
cout<<" Hiace Toyota(2014)\t1126\t35\t\t8000(perday)"<<endl;
cout<<" Parodo Toyota(2015)\t1127\t40\t\t6000(perday)"<<endl;
cout<<"Select your car from its number"<<endl;
cin>>c.carno;
clrscr();
if(c.carno==1123)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Pajero, Model: Mitsubishi(2015) Rent: 5000(Perday)"<<endl;
cout<<"Total Car is: 20";
}
else if(c.carno==1124)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Mehran, Model: Suzuki(2015) Rent: 3500(Perday)"<<endl;
cout<<"Total Car is: 10";
cin>>c.total;
}
else if(c.carno==1125)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Colrolla, Model: Altis(2015) Rent: 4500(Perday)"<<endl;
cout<<"Total Car is: 15";
cin>>c.total;
}
else if(c.carno==1126)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Hiace, Model: Toyota(2015) Rent: 8000(Perday)"<<endl;
cout<<"Total Car is: 35";
cin>>c.total;
}
else if(c.carno==1127)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Parado, Model: Toyota(2015) Rent: 6000(Perday)"<<endl;
cout<<"Total Car is: 40";
cin>>c.total;
}
else
{
cout<<"Sorry you selected no vehical"<<endl;
}
cout<<"Enter Quantity of Car that you want: "<<endl;
cin>>c.quan;
cout<<"Enter Rent Price of Car: "<<endl;
cin>>c.rentpr;
c.rentprice=c.quan*c.rentpr;
clrscr();
cout<<"______________WELCOME TO SHAHID CAR RENTAL CENTER__________________"<<endl;
cout<<"****Bill*****"<<endl;
cout<<"Customer Name: "<<c.customer<<endl;
cout<<"Customer ID: "<<c.id<<endl;
cout<<"Car Model is: "<<c.carno<<endl;
if(c.carno==1123)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Pajero, Model: Mitsubishi(2015) Rent: 5000(Perday)"<<endl;
c.ava=20-c.quan;
cout<<"Now available cars are: "<<c.ava<<endl;
}
else if(c.carno==1124)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Mehran, Model: Suzuki(2015) Rent: 3500(Perday)"<<endl;
c.ava=10-c.quan;
cout<<"Now available cars are: "<<c.ava<<endl;
}
else if(c.carno==1125)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Colrolla, Model: Altis(2015) Rent: 4500(Perday)"<<endl;
c.ava=15-c.quan;
cout<<"Now available cars are: "<<c.ava<<endl;
}
else if(c.carno==1126)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Hiace, Model: Toyota(2015) Rent: 8000(Perday)"<<endl;
c.ava=35-c.quan;
cout<<"Now available cars are: "<<c.ava<<endl;
}
else if(c.carno==1127)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Parado, Model: Toyota(2015) Rent: 6000(Perday)"<<endl;
c.ava=40-c.quan;
cout<<"Now available cars are: "<<c.ava<<endl;
t
else
{
cout<<"Sorry you selected no vehical"<<endl;
}
cout<<"Car Quantity is: "<<c.quan<<endl;
cout<<"Total Rent: "<<c.rentprice<<endl;
getch();
}
#include <iostream>
#include <conio>
#include <cstring>
#include <stdlib>
#include <math.h>
struct car
{
string car;
int rentpr;
int rentprice;
int carno;
int quan;
string customer;
string id;
int ava;
int total;
};
void main()
{
car c;
cout<<"__________________WELCOME TO CAR RENTAL CENTER__________________"<<endl;
cout<<"\tCustomer Detail"<<endl;
cout<<"Enter Your Name"<<endl;
cin>>c.customer;
cout<<"Enter your ID"<<endl;
cin>>c.id;
clrscr();
cout<<"The list of Available cars are following"<<endl;
cout<<" Carname\tModelno\t\tcarno\tTotal\t\tRent"<<endl;
cout<<" Pajero Mitsubishi(2015)1123\t20\t\t5000(perday) "<<endl;
cout<<" Mehran Suzuki(2015)\t1124\t10\t\t3500(perday)"<<endl;
cout<<" Corolla Altis(2015)\t1125\t15\t\t4500(perday)"<<endl;
cout<<" Hiace Toyota(2014)\t1126\t35\t\t8000(perday)"<<endl;
cout<<" Parodo Toyota(2015)\t1127\t40\t\t6000(perday)"<<endl;
cout<<"Select your car from its number"<<endl;
cin>>c.carno;
clrscr();
if(c.carno==1123)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Pajero, Model: Mitsubishi(2015) Rent: 5000(Perday)"<<endl;
cout<<"Total Car is: 20";
}
else if(c.carno==1124)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Mehran, Model: Suzuki(2015) Rent: 3500(Perday)"<<endl;
cout<<"Total Car is: 10";
cin>>c.total;
}
else if(c.carno==1125)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Colrolla, Model: Altis(2015) Rent: 4500(Perday)"<<endl;
cout<<"Total Car is: 15";
cin>>c.total;
}
else if(c.carno==1126)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Hiace, Model: Toyota(2015) Rent: 8000(Perday)"<<endl;
cout<<"Total Car is: 35";
cin>>c.total;
}
else if(c.carno==1127)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Parado, Model: Toyota(2015) Rent: 6000(Perday)"<<endl;
cout<<"Total Car is: 40";
cin>>c.total;
}
else
{
cout<<"Sorry you selected no vehical"<<endl;
}
cout<<"Enter Quantity of Car that you want: "<<endl;
cin>>c.quan;
cout<<"Enter Rent Price of Car: "<<endl;
cin>>c.rentpr;
c.rentprice=c.quan*c.rentpr;
clrscr();
cout<<"______________WELCOME TO SHAHID CAR RENTAL CENTER__________________"<<endl;
cout<<"****Bill*****"<<endl;
cout<<"Customer Name: "<<c.customer<<endl;
cout<<"Customer ID: "<<c.id<<endl;
cout<<"Car Model is: "<<c.carno<<endl;
if(c.carno==1123)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Pajero, Model: Mitsubishi(2015) Rent: 5000(Perday)"<<endl;
c.ava=20-c.quan;
cout<<"Now available cars are: "<<c.ava<<endl;
}
else if(c.carno==1124)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Mehran, Model: Suzuki(2015) Rent: 3500(Perday)"<<endl;
c.ava=10-c.quan;
cout<<"Now available cars are: "<<c.ava<<endl;
}
else if(c.carno==1125)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Colrolla, Model: Altis(2015) Rent: 4500(Perday)"<<endl;
c.ava=15-c.quan;
cout<<"Now available cars are: "<<c.ava<<endl;
}
else if(c.carno==1126)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Hiace, Model: Toyota(2015) Rent: 8000(Perday)"<<endl;
c.ava=35-c.quan;
cout<<"Now available cars are: "<<c.ava<<endl;
}
else if(c.carno==1127)
{
cout<<"Car Detail:"<<endl;
cout<<"Car Name: Parado, Model: Toyota(2015) Rent: 6000(Perday)"<<endl;
c.ava=40-c.quan;
cout<<"Now available cars are: "<<c.ava<<endl;
t
else
{
cout<<"Sorry you selected no vehical"<<endl;
}
cout<<"Car Quantity is: "<<c.quan<<endl;
cout<<"Total Rent: "<<c.rentprice<<endl;
getch();
}
Output Result:
Car rental |
Post a Comment