I want to show full name in the following code my it shows only the fisrt chracter
what should be the correct code so that it would show the complete name
Code:
#include<conio.h>#include<iostream.h>
class air_line
{
private:
char name[5][100];
long double opt,cnic[5],ticket_number[5],ticket_number1;
int opt1,seat_type;
public:
void phool_bootey_start()
{
cout<<"================================================================================";
cout<<"\t\t\tWelcome to Google Airlines \n";
cout<<"================================================================================";
}
void input()
{
for(int i=1;i<=5;i++)
{
cout<<"\n";
cout<<"Please Enter Your Name : ";
getchar(name[i]);
cout<<"Please Enter Your CNIC Number : ";
cin>>cnic[i];
cout<<"Please Enter Your Ticket Number : ";
cin>>ticket_number[i];
}
}
void process()
{
cout<<"Enter your option \n 1.Fare \n 2.Ticket Confirmation \n ";
cin>>opt;
if(opt==1)
{
cout<<"\nSelect Journey \n 1.Pakistan\n 2.Abroad \n";
cin>>opt1;
switch(opt1)
{
case 1:
cout<<"\nSelect Seat Type \n1.Economy\n2.Business\n3.Upper Business\n";
cin>>seat_type;
if(seat_type==1)
{
cout<<"\n********************** FARES FOR PAKISTAN 09 JUNE 2013 ************************";
cout<<"\n\n ";
cout<<"Departure \t Timings\t Arrival \t Timings \t Fare \n ";
cout<<"\n Islmabad \t 05:00 AM \t Lahore \t 05:30 AM \t 10500 PKR";
cout<<"\n Islmabad \t 09:00 AM \t Karachi \t 11:30 AM \t 20000 PKR";
cout<<"\n Islmabad \t 01:00 PM \t Peshawar \t 02:30 PM \t 10000 PKR";
cout<<"\n Islmabad \t 05:00 PM \t Quetta \t 07:00 PM \t 25000 PKR";
cout<<"\n Islmabad \t 11:00 PM \t Sialkot \t 12:30 PM \t 55000 PKR ";
}
if(seat_type==2)
{
cout<<"\n********************** FARES FOR PAKISTAN 09 JUNE 2013 ************************";
cout<<"\n\n ";
cout<<"Departure \t Timings\t Arrival \t Timings \t Fare \n ";
cout<<"\n Islmabad \t 05:00 AM \t Lahore \t 05:30 AM \t 12100 PKR";
cout<<"\n Islmabad \t 09:00 AM \t Karachi \t 11:30 AM \t 30000 PKR";
cout<<"\n Islmabad \t 01:00 PM \t Peshawar \t 02:30 PM \t 20000 PKR";
cout<<"\n Islmabad \t 05:00 PM \t Quetta \t 07:00 PM \t 35000 PKR";
cout<<"\n Islmabad \t 11:00 PM \t Sialkot \t 12:30 PM \t 45000 PKR ";
}
if(seat_type==3)
{
cout<<"\n********************** FARES FOR PAKISTAN 09 JUNE 2013 ************************";
cout<<"\n\n ";
cout<<"Departure \t Timings\t Arrival \t Timings \t Fare \n ";
cout<<"\n Islmabad \t 05:00 AM \t Lahore \t 05:30 AM \t 20500 PKR";
cout<<"\n Islmabad \t 09:00 AM \t Karachi \t 11:30 AM \t 40000 PKR";
cout<<"\n Islmabad \t 01:00 PM \t Peshawar \t 02:30 PM \t 50000 PKR";
cout<<"\n Islmabad \t 05:00 PM \t Quetta \t 07:00 PM \t 65000 PKR";
cout<<"\n Islmabad \t 11:00 PM \t Sialkot \t 12:30 PM \t 75000 PKR ";
}
break;
case 2:
cout<<"\nSelect Seat Type \n1.Economy\n2.Business\n3.Upper Business\n";
cin>>seat_type;
if(seat_type==1)
{
cout<<"\n*********************** Fares FOR ABROAD 09 JUNE 2013 *************************";
cout<<"\n\n ";
cout<<"Departure \t Timings\t Arrival \t Timings \t Fare \n ";
cout<"Islmabad \t 05:00 AM \t Dubai UAE \t 24000 PKR";
cout<<"\n Islmabad \t 09:00 AM \t Wishington \t 03:00 PM \t 70000 PKR";
cout<<"\n Islmabad \t 01:00 PM \t California \t 01:00 AM \t 82000 PKR";
cout<<"\n Islmabad \t 05:00 PM \t Beijing \t 08:00 PM \t 30000 PKR";
cout<<"\n Islmabad \t 11:00 PM \t Tehran \t 04:00 PM \t 17000 PKR ";
}
if(seat_type==2)
{
cout<<"\n*********************** Fares FOR ABROAD 09 JUNE 2013 *************************";
cout<<"\n\n ";
cout<<"Departure \t Timings\t Arrival \t Timings \t Fare \n ";
cout<"Islmabad \t 05:00 AM \t Dubai UAE \t 34000 PKR";
cout<<"\n Islmabad \t 09:00 AM \t Wishington \t 03:00 PM \t 40000 PKR";
cout<<"\n Islmabad \t 01:00 PM \t California \t 01:00 AM \t 52000 PKR";
cout<<"\n Islmabad \t 05:00 PM \t Beijing \t 08:00 PM \t 50000 PKR";
cout<<"\n Islmabad \t 11:00 PM \t Tehran \t 04:00 PM \t 67000 PKR ";
}
if(seat_type==3)
{
cout<<"\n*********************** Fares FOR ABROAD 09 JUNE 2013 *************************";
cout<<"\n\n ";
cout<<"Departure \t Timings\t Arrival \t Timings \t Fare \n ";
cout<"Islmabad \t 05:00 AM \t Dubai UAE \t 24000 PKR";
cout<<"\n Islmabad \t 09:00 AM \t Wishington \t 03:00 PM \t 90000 PKR";
cout<<"\n Islmabad \t 01:00 PM \t California \t 01:00 AM \t 92000 PKR";
cout<<"\n Islmabad \t 05:00 PM \t Beijing \t 08:00 PM \t 90000 PKR";
cout<<"\n Islmabad \t 11:00 PM \t Tehran \t 04:00 PM \t 99000 PKR ";
}
break;
default:
cout<<"Wrong Statement Entered";
}
}
else if(opt==2)
{
cout<<"\n Please Enter Your Ticket Number : ";
cin>>ticket_number1;
for (int i=1;i<=5;i++)
{
if(ticket_number1==ticket_number[i])
{
cout<<"\n Your Seat is Confirmed ";
cout<<"\n Name of Passenger is: "<<putchar[i];
cout<<"\n CNIC No. :"<<cnic[i];
}
}}
else
cout<<"Wrong Statement Entered";
}
void phool_bootey_end()
{
cout<<"\n\n================================================================================";
cout<<"\t:)Thanks for Visiting Google Airlines - Have a Safe Journey :)\n";
cout<<"================================================================================";
}
};
main()
{
clrscr();
air_line tahir;
tahir.phool_bootey_start();
tahir.input();
tahir.process();
tahir.phool_bootey_end();
getch();
}