Hello everone.. Iam having errors while complilimg this function.. Plz help...
Function :
Code:void new_ticket() { FILE *fpt; char reserve, p_name,dest; char seat_type,date,time; int p_cost,s,choi; char day; fpt = fopen("Reservation.txt", "a+"); for ( s=0; s<=50;++s) { printf("\n Do you want to issue a new ticket? Enter Y or N ..."); scanf("%c",&reserve); if reserve =='N' break; else { printf ("\n ``````````````````````````````"); printf ("\n 1. London- UK"); printf ("\n 2. Paris - France"); printf ("\n 3. Dubai- UAE"); printf ("\n 4. Rome- Italy"); printf ("\n 5. Sydney -Australia"); printf ("\n Please select a destination..:"); scanf("%d",&choi); switch (choi) { case '1': dest='London'; day='Monday'; time=20.45; printf("\n Please select a date:"); scanf("%s",&date); printf("\n Please select the type of seat: T for tourist and F for first class"); scanf("c",&seat_type); printf("\n Your flight to %s is scheduled for %s %s at %.s ",dest,day,date,time); printf("\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); break; case '2': dest=='Paris'; day=='Tuesday'; time=='07.00'; printf("\n Please select a date:"); scanf("%s",&date); printf("\n Please select the type of seat: T for tourist and F for first class"); scanf("c",&seat_type); printf("\n Your flight to % is scheduled for %s %s at %.s ",dest,day,date,time); printf("\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); break; case '3': dest=='Dubai'; day=='Wednesday'; time=='15.30'; printf("\n Please select a date:"); scanf("%s",&date); printf("\n Please select the type of seat: T for tourist and F for first class"); scanf("c",&seat_type); printf("\n Your flight to %s is scheduled for %s %s at %.s ",dest,day,date,time); printf("\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); break; case '4': dest=='Rome'; day=='Thursday'; time=='12.00'; printf("\n Please select a date:"); scanf("%s",&date); printf("\n Please select the type of seat: T for tourist and F for first class"); scanf("c",&seat_type); printf("\n Your flight to %s is scheduled for %s %s at %.s ",dest,day,date,time); printf("\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); break; case '5': dest=='Sydney'; day=='Friday'; time=='22.00'; printf("\n Please select a date:"); scanf("%s",&date); printf("\n Please select the type of seat: T for tourist and F for first class"); scanf("c",&seat_type); printf("\n Your flight to %s is scheduled for %s %s at %.s ",dest,day,date,time); printf("\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); break; } fprintf(fpt,"%d",s); fprintf(fpt,"%s",dest); fprintf(fpt, "%2d/",day); fprintf(fpt, "%2d/",date); fprintf(fpt, "%s", time); fprintf(fpt, "%s",p_name); fprintf(fpt, "%c",seat_type); fprintf(fpt, "%d\n", p_cost); fprintf(fpt, "%c", reserve); fclose(fpt); } } }
Here is the error that i get with visual c++ 6.0 :
Code:Compiling... test1.c C:\Documents and Settings\Desktop\C prog\test1.c(68) : error C2061: syntax error : identifier 'reserve' C:\Documents and Settings\l\Desktop\C prog\test1.c(71) : error C2181: illegal else without matching if C:\Documents and Settings\\Desktop\C prog\test1.c(86) : error C2015: too many characters in constant C:\Documents and Settings\\Desktop\C prog\test1.c(87) : error C2015: too many characters in constant C:\Documents and Settings\\Desktop\C prog\test1.c(88) : warning C4244: '=' : conversion from 'const double ' to 'char ', possible loss of data C:\Documents and Settings\Desktop\C prog\test1.c(97) : error C2015: too many characters in constant C:\Documents and Settings\\Desktop\C prog\test1.c(97) : warning C4553: '==' : operator has no effect; did you intend '='? C:\Documents and Settings\\Desktop\C prog\test1.c(98) : error C2015: too many characters in constant C:\Documents and Settings\\Desktop\C prog\test1.c(98) : warning C4553: '==' : operator has no effect; did you intend '='? C:\Documents and Settings\Desktop\C prog\test1.c(99) : error C2015: too many characters in constant C:\Documents and Settings\Desktop\C prog\test1.c(99) : warning C4553: '==' : operator has no effect; did you intend '='? C:\Documents and Settings\\Desktop\C prog\test1.c(109) : error C2015: too many characters in constant C:\Documents and Settings\\Desktop\C prog\test1.c(109) : warning C4553: '==' : operator has no effect; did you intend '='? C:\Documents and Settings\\Desktop\C prog\test1.c(110) : error C2015: too many characters in constant C:\Documents and Settings\Desktop\C prog\test1.c(110) : warning C4553: '==' : operator has no effect; did you intend '='? C:\Documents and Settings\Desktop\C prog\test1.c(111) : error C2015: too many characters in constant C:\Documents and Settings\\Desktop\C prog\test1.c(111) : warning C4553: '==' : operator has no effect; did you intend '='? C:\Documents and Settings\\Desktop\C prog\test1.c(120) : warning C4553: '==' : operator has no effect; did you intend '='? C:\Documents and Settings\\Desktop\C prog\test1.c(121) : error C2015: too many characters in constant C:\Documents and Settings\\Desktop\C prog\test1.c(121) : warning C4553: '==' : operator has no effect; did you intend '='? C:\Documents and Settings\Desktop\C prog\test1.c(122) : error C2015: too many characters in constant C:\Documents and Settings\\Desktop\C prog\test1.c(122) : warning C4553: '==' : operator has no effect; did you intend '='? C:\Documents and Settings\\Desktop\C prog\test1.c(131) : error C2015: too many characters in constant C:\Documents and Settings\\Desktop\C prog\test1.c(131) : warning C4553: '==' : operator has no effect; did you intend '='? C:\Documents and Settings\\Desktop\C prog\test1.c(132) : error C2015: too many characters in constant C:\Documents and Settings\\Desktop\C prog\test1.c(132) : warning C4553: '==' : operator has no effect; did you intend '='? C:\Documents and Settings\\Desktop\C prog\test1.c(133) : error C2015: too many characters in constant C:\Documents and Settings\\Desktop\C prog\test1.c(133) : warning C4553: '==' : operator has no effect; did you intend '='? Error executing cl.exe. test1.obj - 15 error(s), 13 warning(s)
plzz helppppppppp........