help me pls im stock T.T

#include<cctype.h>
#include<iostream.h>
#include<string.h>
#include<sstream.h>
#include<cstring.h>
#include<istream.h>

int assignseat(int seat_num, int row_num, int pass_num);
int num1(char*);
int num2(char*);
int i, j;

int numseats=12;

void initializeseats();
void reserve();
void cancel();
void changeseat();
void display();

struct seat{
char pass_name;
int available;
};

struct seat seatarray[6][2];

int main()
{
char seatchoice=0;
int row_num=6;
char a=0;
char w=0;

int total_passenger=12;

char arr1[][6]={"1A", "2A", "3A", "4A", "5A", "6A"};
char arr2[][6]={"1B", "2B", "3B", "4B", "5B", "6B"};

int menuchoice;

initializeseats();
while(1)
{
printf("1.reserve");
printf("2.cancel");
printf("3.change seat");
printf("4.display");
printf("5.exit");
printf("enter your choice:");
scanf("%d",&menuchoice);

if((menuchoice<0)&&(menuchoice>5))
{
puts("invalid choice");
system("pause try again");
}
else
{
switch(menuchoice){
case 1:reserve();break;
case 2:cancel();break;
case 3:changeseat();break;
case 4:display();break;
case 5:exit(1);
}
}
}
return 0;
}
void reserve()//this function is for reserve the seats
{
int pass_num=0;
int i, j;
prinft("Welcome to cheapskate airline passenger seat assigment");
prinft("all %d seats are available", numseats);
for(i=0;i<6;i++)
{
for(j=0;j<2;j++)
{
if(seatarray[i][j].available==1)
{
printf("please enter the passenger name: ");
scanf("%s",seatarray[i][j].pass_name);
seatarray[i][j].available-0;
numseats--;
return;
}
}
}
}
void cancel()//this function is for cancel the seats
{
char cancelpassengername[80];
int i, j;
printf("enter the passenger to be canceled:");
scanf("%s",&cancelpassengername);
for(i=0;i<6;i++)
{
for(j=0;j<2;j++)
{
if(strcmp(seatarray[i][j].pass_name,cancelpassengername)==0)
{
numseats++;
seatarray[i][j].available=1;
return;
}
}
}
printf("passenger not in the list");
}
void changeseat()//this function is for change the seats
{
char movepassenger[80];
int seatrow, seatcolumn, i, j;

printf("enter the passenger name to be move: ");
scanf("%s",&movepassenger);

for(i=0;i<6;i++)
{
for(j=0;j<2;j++)
{
if(strcmp(seatarray[i][j].pass_name, movepassenger)==0)
{
seatrow=i;
seatcolumn=j;
}
}
}
if(numseats<=0)
{
printf("no seat available there for you cannot change seat");
return;
}
else{
for(i=0;i<6;i++)
{
for(j=0;j<2;j++)
{
if(seatarray[i][j].available==1)
{
strcpy_s(seatarray[i][j].pass_name,movepassenger);
seatarray[seatrow][seatcolumn].available==1;
seatarray[i][j].available=0;
return;
}
}
}
}
}
void display()//display the seat assignment for all reservation
{
for(i=0;i<6;i++)
{
for(j=0;j<2;j++)
{
if(seatarray[i][j].available==0)
{
printf("%s %d",seatarray[i][j].pass_name, numseat);
}
else
{
if(j==1)
printf(i+1"b");
else
printf(i+1"a");
}
}
}
}
void initializeseats()//initialy all seats are available
{
for(i=0;i<12;i++)
{
for(j=0;j<2;j++)
seatarray[i][j].available=1;
}
}
a) Use code tags when posting code.
b) State your problem clearly.
c) Do not use deprecated .h version of headers
d) There is no prinft() function.
... I didn't look further. You didn't even try to do this yourself, did you? All errors are clearly stated by the compiler.
Last edited on
Topic archived. No new replies allowed.