#include
#include
#include
#include
using namespace std;
void welcome();
void explain();
int assignment();
char display(char* board);
char judge(char* board);
bool legal(int line, int column,char* board);
void bye();
char enter(char* board);
const char X='X';
const char N='N';
int main()
{
int line=7,column=4;
char board
welcome();
explain();
int i=0,j;
for(i=0;i<7;i++){
for(j=0;j<4;j++)
cout<< (assignment()+i)[j]<<endl;
}
display(&board);
enter(&board);
while(judge(&board)==N)
{
cout<<"enter again,sir!"<<endl;
enter(&board);
display(&board);
}
bye();
system("pause");
return 0;
}
void wlcome()
{
cout<<"Welcome to flight booking platform, I am Weiwei! Glad to be of service."<<endl;
}
void explain()
{
cout<<"Let me teach you how to book a table in the next"<<endl;
cout<<"We will show an interface"<<endl;
cout<<"As long as the above no X can I make a reservation And booking your input(line and column)"<<endl;
cout<<"Now we will pop-up book interface!"<<endl;
cout<<"1 A B CD\n";
cout<<"2 A B CD\n";
cout<<"3 A B CD\n";
cout<<"4 A B CD\n";
cout<<"5 A B CD\n";
cout<<"6 A B CD\n";
cout<<"7 A B CD\n";
}
int *assignment()
{
int line=7,column=4;
char board[line][column]={ {A,B,C,D},
(A,B,C,D),
{A,B,C,D},
{A,B,C,D},
{A,B,C,D},
{A,B,C,D},
{A,B,C,D}};
return board[0];
}
inline bool legal(int line, int column,char* board)
{
return(board[line][column]!=X);
}
char enter(char* board)
{
int line,column;
cout<<"Enter a line"< cin>>line;
cout<<"Enter a column"< cin>>column;
while(!legal(line,column,board))
{
cout<<"\nSorry sir,it's defauly,please enter again\n";
enter(&board);
}
board[line][column]=X;
}
char display(char* board)
{
cout<<"\n\t"<<board[0][0]<<" "<<boaed[0][1]<<" "<<board[0][2]<<" "<<board[0][3];
cout<<"\n\t"<<board[1][0]<<" "<<boaed[1][1]<<" "<<board[1][2]<<" "<<board[1][3];
cout<<"\n\t"<<board[2][0]<<" "<<boaed[2][1]<<" "<<board[2][2]<<" "<<board[2][3];
cout<<"\n\t"<<board[3][0]<<" "<<boaed[3][1]<<" "<<board[3][2]<<" "<<board[3][3];
cout<<"\n\t"<<board[4][0]<<" "<<boaed[4][1]<<" "<<board[4][2]<<" "<<board[4][3];
cout<<"\n\t"<<board[5][0]<<" "<<boaed[5][1]<<" "<<board[5][2]<<" "<<board[5][3];
cout<<"\n\t"<<board[6][0]<<" "<<boaed[6][1]<<" "<<board[6][2]<<" "<<board[6][3];
cout<<"\n\n";
}
char judge(char* board)
{
int line,column;
for(line=0;line<7;line++)
for(column=0;column<4;column++)
if(board[line][column]!=X)
{
cout<<"You can also book again"<<endl;
return N;
}
else
cout<<"The shipping space is full,I'm sorry!"<<endl;
}
void bye()
{
cout<<"I'm glad to serve you this time ,looking forward to your coming next time,byebye!"<<endl;
}
#include <>
头文件肿么可以那样写
你想怎么改啊?说一下要求啊
你的意思使用C++实现上面的功能么?
我说说我的思路:
首先有一个座位的类,里面包含的成员有,座位的排数,列数,以及状态(X,A,B,C,D...);
然后有一个飞机的类,里面包含总共有多少行多少列(就是有多少个位置),成员函数有状态的初始化,显示,设置,查询等功能;
你的意思使用C++实现上面的功能么?
我说说我的思路:
首先有一个座位的类,里面包含的成员有,座位的排数,列数,以及状态(X,A,B,C,D...);
然后有一个飞机的类,里面包含总共有多少行多少列(就是有多少个位置),成员函数有状态的初始化,显示,设置,查询等功能;
楼主重新改写一下内容的格式吧。。。代码的话用用两个'```'包装起来