void main (void)
{
char name [2] [30], number [2] [10];
char << "Please type your first name, a blank, and last name) << endl;
cin >> name;
cout << "Name=" <<name << endl;
cout << "Please type a number, press the return key, and another number << endl;
cin >> number [0] >> endl;
cout << number << endl;
}
答案 0 :(得分:5)
太多了,但我们不是来做家庭作业。检查编译器的输出,然后一次处理一个:
qq.cpp:4:13: warning: missing terminating " character
qq.cpp:4: error: missing terminating " character
qq.cpp:7:13: warning: missing terminating " character
qq.cpp:7: error: missing terminating " character
qq.cpp:1: error: ‘::main’ must return ‘int’
qq.cpp: In function ‘int main()’:
qq.cpp:4: error: expected unqualified-id before ‘<<’ token
qq.cpp:6: error: ‘cout’ was not declared in this scope
qq.cpp:6: error: ‘endl’ was not declared in this scope
qq.cpp:8: error: ‘cin’ was not declared in this scope
至少:
using
子句或std::
前缀。char
不是一个流。答案 1 :(得分:1)
在"Please type your first name, a blank, and last name)
答案 2 :(得分:1)
您不会使用“in in
结束字符串char << "Please type your first name, a blank, and last name) << endl;
和
cout << "Please type a number, press the return key, and another number << endl;
它应该是:
int main (void)
{
char name [2] [30], number [2] [10];
char << "Please type your first name, a blank, and last name)" << endl;
cin >> name;
cout << "Name=" <<name << endl;
cout << "Please type a number, press the return key, and another number" << endl;
cin >> number [0] >> endl;
cout << number << endl;
return 0;
}
答案 3 :(得分:1)
char << "Please type your first name, a blank, and last name) << endl;
和
cout << "Please type a number, press the return key, and another number << endl;
都缺少结束双引号
char << "Please type your first name, a blank, and last name)" << endl;
cout << "Please type a number, press the return key, and another number" << endl