程序是这样的:
#include
using namespace std;
char*stab[4][5]={{"姓名","数学","语文","英语","综合"},
{"张丽"," "," "," "," "},
{"李丽"," "," "," "," "},
{"王丽"," "," "," "," "}};
void accept()
{
for(int i=1;i<4;++i)
{
cout<<"\n输入<"<的成绩"< for(int j=1;j<5;j++)
{
cout< stab[i][j]=new char;
cin>>stab[i][j];
}
}
}
void display()
{
for(int i=0;i<4;++i)
{
cout<<"\n\t---------------------------------"< for(int j=0;j<5;++j)
{
cout<<"\t"< }
}
cout<<"\n\t---------------------------------"<}
int main()
{
accept();
display();
return 0;
}
问题就是,如果去掉了stab[i][j]=new char;这个语句,编译,链接,都正常,可是在显示的时候输入第一个数后就会出现"发送错误报告",我不明白这是怎么回事,还请高手解释一下,这个new char是什么意思,还有在这个程序里面的i ,j的前辍和后辍,我互相改变,显示结果却不变,这个让我的头脑乱七八糟的,还有就是去掉最后的return 0;也不影响结果的输出,这又为什么,还请帮我看看,非常感谢!
--------------------next---------------------
阅读(1289) | 评论(0) | 转发(0) |