04-15-2011, 07:16 AM
Do not copy the whole code. Try to make changes. Like change the variable name and also change the function name. It will be better. the Good programming practice is this give comments then it will be fine.
![[Image: cplusplus.jpg]](http://www.codercaste.com/wp-content/uploads/2011/02/cplusplus.jpg)
#include<conio.h>
#include<iostream.h>
void rent(void);
main()
{
rent();
getch();
}
void rent(void)
{
char option,customer_name[15],car_no[7];
int carmodel,days,rentamount,chargamount;
cout<<"please provide customer name:"<<endl;
cin>>cus_name;
cout<<"please provide car model description\n Enter 'A' for model 2009.\nEnter 'B' for
model 2010.\nEnter 'C' for model 2011.\n"<<endl;
cin>>option;
cout<<"please provide car No:"<<endl;
cin>>car_no;
cout<<"please provide number of Day's"<<endl;
cin>>days;
if(option=='A')
{
model=2009;
charged_amount=5000;
cout<<"customer name: "<<customer_name<<endl;
cout<<"Car Model : "<<carmodel<<endl;
cout<<"Number of days: "<<days<<endl;
cout<<"Car No. : "<<carno<<endl;
rentamount=chargamount*days;
cout<<"Your Rental Amount is: "<<rentamount<<endl;
}
else if(option=='B')
{
model=2010;
charged_amount=8000;
cout<<"customer name: "<<customer_name<<endl;
cout<<"Car Model : "<<carmodel<<endl;
cout<<"Number of days: "<<days<<endl;
cout<<"Car No. : "<<carno<<endl;
rentamount=chargamount*days;
cout<<"Your Rental Amount is: "<<rentamount<<endl;
}
else if(option=='C')
{
model=2011;
charged_amount=10000;
cout<<"customer name: "<<customer_name<<endl;
cout<<"Car Model : "<<carmodel<<endl;
cout<<"Number of days: "<<days<<endl;
cout<<"Car No. : "<<carno<<endl;
rentamount=chargamount*days;
cout<<"Your Rental Amount is: "<<rentamount<<endl;
}
else
cout<<"You must be enter only A,B,C Right Now"<<endl;
}
Please make some change Otherwise U get 0 marks
mileys4:
![[Image: cplusplus.jpg]](http://www.codercaste.com/wp-content/uploads/2011/02/cplusplus.jpg)
#include<conio.h>
#include<iostream.h>
void rent(void);
main()
{
rent();
getch();
}
void rent(void)
{
char option,customer_name[15],car_no[7];
int carmodel,days,rentamount,chargamount;
cout<<"please provide customer name:"<<endl;
cin>>cus_name;
cout<<"please provide car model description\n Enter 'A' for model 2009.\nEnter 'B' for
model 2010.\nEnter 'C' for model 2011.\n"<<endl;
cin>>option;
cout<<"please provide car No:"<<endl;
cin>>car_no;
cout<<"please provide number of Day's"<<endl;
cin>>days;
if(option=='A')
{
model=2009;
charged_amount=5000;
cout<<"customer name: "<<customer_name<<endl;
cout<<"Car Model : "<<carmodel<<endl;
cout<<"Number of days: "<<days<<endl;
cout<<"Car No. : "<<carno<<endl;
rentamount=chargamount*days;
cout<<"Your Rental Amount is: "<<rentamount<<endl;
}
else if(option=='B')
{
model=2010;
charged_amount=8000;
cout<<"customer name: "<<customer_name<<endl;
cout<<"Car Model : "<<carmodel<<endl;
cout<<"Number of days: "<<days<<endl;
cout<<"Car No. : "<<carno<<endl;
rentamount=chargamount*days;
cout<<"Your Rental Amount is: "<<rentamount<<endl;
}
else if(option=='C')
{
model=2011;
charged_amount=10000;
cout<<"customer name: "<<customer_name<<endl;
cout<<"Car Model : "<<carmodel<<endl;
cout<<"Number of days: "<<days<<endl;
cout<<"Car No. : "<<carno<<endl;
rentamount=chargamount*days;
cout<<"Your Rental Amount is: "<<rentamount<<endl;
}
else
cout<<"You must be enter only A,B,C Right Now"<<endl;
}
Please make some change Otherwise U get 0 marks
mileys4:
