c++运行时的问题

来源:百度知道 编辑:UC知道 时间:2024/06/15 16:25:26
运行后出现:d:\c++\msdev98\myprojects\456\456.cpp(18) : fatal error C1010: unexpected end of file while looking for precompiled header directive
执行 cl.exe 时出错. 哪位而给解决下
完整的显示是--------------------Configuration: 9887 - Win32 Debug--------------------
Compiling...
StdAfx.cpp
Compiling...
9887.cpp
d:\c++\msdev98\myprojects\9887\9887.cpp(12) : fatal error C1010: unexpected end of file while looking for precompiled header directive
执行 cl.exe 时出错.

9887.exe - 1 error(s), 0 warning(s) 程序是
#include<stdio.h>
int main()
{
int i,x,y,last=1; /*变量last保存求X的Y次方过程中的部分乘积的后三位*/
printf("Input X and Y(X**Y):");
scanf("%d**%d",&x,&y);
for(i=1;i<=y;i++) /*X自乘Y次*/
last=last*x%1000; /*将last乘X后对1000取模,即求积的后三位*/
printf("The last 3 digits of %d**%d is:%d\n",x,y,last%1000); /*打印结果*/
}

没有找到预编译头文件,
包含stdafx.h就可以了.

当然前提是有这个文件. 如果没有可以自己创建一个和它的cpp文件.

把main前面的int改成void就可以了。

需要添加头文件#include "stdafx.h"

没有找到预编译头文件,
需要添加头文件#include "stdafx.h"