04-18-2011, 03:02 AM
i am using these cods but output is not display.
error code bhi tu batao also attach .cpp file please
Code:
#include <iostream.h>
main()
{
int days;
int rent;
char model;
char name;
char carNo;
cout <<"Please provide customer name : \t";
cin >>name;
cout <<"Please Provide the model discription:\n";
cout <<"\t Enter 'A' for Model 2009 :\n";
cout <<"\t Enter 'B' for Model 2010 :\n";
cout <<"\t Enter 'C' for Model 2011 :\n";
cin >>model;
cout <<"Please Provide the following discription:";
cout <<"\nCarNo.\t\t";
cin >>carNo;
cout << "Enter days.";
cin >>days;
cout <<"\nRent per day for 2009 is Rs. 5000. \n";
cout <<"Rent per day for 2010 is Rs. 8000. \n";
cout <<"Rent per day for 2009 is Rs. 10000. \n";
switch(model)
{
case 'A':
case 'a':
cout << "Customer Name \t" <<name;
cout << "Car Model \t2009\n";
cout << "Car No.\t" <<carNo;
cout << "No of days\n" << days;
rent= amount(model*days);
cout <<"Your rental amount is :\t" << rent;
break;
case 'B':
case 'b':
cout << "Customer Name \t" <<name;
cout << "Car Model \t2010\n";
cout << "Car No.\t" <<carNo;
cout << "No of days\n" << days;
rent= (days*8000);
cout <<"Your rental amount is :\t" << rent;
break;
case 'C':
case 'c':
cout << "Customer Name \t" <<name;
cout << "Car Model \t2011\n";
cout << "Car No.\t" <<carNo ;
cout << "No of days\n" << days;
rent= (days*10000);
cout <<"Your rental amount is :\t" << rent;
break;
defualt:
cout <<"Please select only 2009,2010,2011. car models.";
}
system("pause");
}
int amount(char m, int d){
if( m== 'A' || m== 'a')
return (5000*d);
else if( m== 'B' || m== 'b')
return (8000*d);
else if( m== 'C' || m== 'c')
return (10000*d);
}