新橄榄核怎么盘玩:程序高手。我是新学者。遇到难题了。望高手不吝指教

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/28 16:54:51
#include "iostream.h"
int main()
{
int key;
cout<<"请输入密码:";
cin>>key;
if(key==1234)
{
cout<<"密码输入正确!"<<endl;
cout<<"欢迎进入c++世界!"<<endl;
}
return 1;
}

上面是我按照教程中写的一个简单的C++源程序。
但是在编译的时候。提示发生错误。
错误代码如下:
f:\program files\microsoft visual studio\myprojects\program5\program5.cpp(14) : fatal error C1010: unexpected end of file while looking for precompiled header directive
还是一样的结果。请注意。错误代码提示为第14行。
但是我这个程序根本就没有第14行啊。。

多谢3楼的答案。但是改了之后还是一样的。555555555

吧stdafx.h换成stdio.h

#include "iostream.h"
改为
#include <iostream.h>
或改为
#include <iostream>
using namespace std;

#include <iostream.h>
void main()
{
int key;
cout<<"请输入密码:";
cin>>key;
if(key==1234)
{
cout<<"密码输入正确!"<<endl;
cout<<"欢迎进入c++世界!"<<endl;
}
else
cout<<"密码错误!"<<endl;
}

你这么写一下
应该没有错误了
我已经调试了 在vc++ 6.0的环境中
顺便帮你加上了 当输入密码错误的情况的提示
如果出错 应该是你编译器的错误

program files\microsoft visual studio\myprojects\program5\program5.cpp(14) : fatal error C1010: unexpected end of file while looking for precompiled header directive
节目档案\Microsoft视觉工作室\myprojects\Program5\Program5.cpp(14):致命错误C1010:提出指示,寻找precompiled