VC++ missing function header (old-style formal list?)

来源:百度知道 编辑:UC知道 时间:2024/06/25 21:12:30
#include <iostream.h>
{
int 1="hello\n";
int 2="i'm Mr.Li\n";
int 3="how are you\n";
int 4="you are shit\n";
int 5="you are shit\n";
int 6="you are shit\n";
ofstream a("about.txt");
a<<1<<endl<<2<<endl<<3<<endl<<4<<endl<<5<<endl<<6<<endl;
}

error C2447: missing function header (old-style formal list?)

急啊 现在没什么分了

少了函数头,如int main()。而且数字不能作为变量名,字符串应该是string(在头文件string中)或char*类型。
你不是学C++的吧?

#include <iostream.h>
int main()//主函数
{
int 1="hello\n";
int 2="i'm Mr.Li\n";
int 3="how are you\n";
int 4="you are shit\n";
int 5="you are shit\n";
int 6="you are shit\n";
ofstream a("about.txt");
a<<1<<endl<<2<<endl<<3<<endl<<4<<endl<<5<<endl<<6<<endl;
return 0;//返回
}

变量好像不能以数字开头,把1—6 换成a(1-6) 试试

int类型的字符串?