问题描述
- 能帮忙修改下吗 C++ 我是初学者
- #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 columnchar* board);
void bye();
char enter(char* board);
const char X='X';
const char N='N';
int main()
{
int line=7column=4;
char board
welcome();
explain();
int i=0j;
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 againsir!""<<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 CDn"";
cout<<""2 A B CDn"";
cout<<""3 A B CDn"";
cout<<""4 A B CDn"";
cout<<""5 A B CDn"";
cout<<""6 A B CDn"";
cout<<""7 A B CDn"";
}
int *assignment()
{
int line=7column=4;
char board[line][column]={ {ABCD}
(ABCD)
{ABCD}
{ABCD}
{ABCD}
{ABCD}
{ABCD}};
return board[0];}
inline bool legal(int line int columnchar* board)
{
return(board[line][column]!=X);}
char enter(char* board)
{
int linecolumn;
cout<<""Enter a line""< cin>>line;
cout<<""Enter a column""< cin>>column;
while(!legal(linecolumnboard))
{
cout<<""nSorry sirit's defaulyplease enter againn"";
enter(&board);
}
board[line][column]=X;
}
char display(char* board)
{
cout<<""nt""<<board[0][0]<<"" ""<<boaed[0][1]<<"" ""<<board[0][2]<<"" ""<<board[0][3];
cout<<""nt""<<board[1][0]<<"" ""<<boaed[1][1]<<"" ""<<board[1][2]<<"" ""<<board[1][3];
cout<<""nt""<<board[2][0]<<"" ""<<boaed[2][1]<<"" ""<<board[2][2]<<"" ""<<board[2][3];
cout<<""nt""<<board[3][0]<<"" ""<<boaed[3][1]<<"" ""<<board[3][2]<<"" ""<<board[3][3];
cout<<""nt""<<board[4][0]<<"" ""<<boaed[4][1]<<"" ""<<board[4][2]<<"" ""<<board[4][3];
cout<<""nt""<<board[5][0]<<"" ""<<boaed[5][1]<<"" ""<<board[5][2]<<"" ""<<board[5][3];
cout<<""nt""<<board[6][0]<<"" ""<<boaed[6][1]<<"" ""<<board[6][2]<<"" ""<<board[6][3];
cout<<""nn"";
}
char judge(char* board)
{
int linecolumn;
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 fullI'm sorry!""<<endl;
}
void bye()
{
cout<<""I'm glad to serve you this time looking forward to your coming next timebyebye!""<<endl;
}
解决方案
#include <>
头文件肿么可以那样写
解决方案二:
你想怎么改啊?说一下要求啊
解决方案三:
你的意思使用C++实现上面的功能么?
我说说我的思路:
首先有一个座位的类,里面包含的成员有,座位的排数,列数,以及状态(X,A,B,C,D...);
然后有一个飞机的类,里面包含总共有多少行多少列(就是有多少个位置),成员函数有状态的初始化,显示,设置,查询等功能;
解决方案四:
你的意思使用C++实现上面的功能么?
我说说我的思路:
首先有一个座位的类,里面包含的成员有,座位的排数,列数,以及状态(X,A,B,C,D...);
然后有一个飞机的类,里面包含总共有多少行多少列(就是有多少个位置),成员函数有状态的初始化,显示,设置,查询等功能;
解决方案五:
楼主重新改写一下内容的格式吧。。。代码的话用用两个'```'包装起来