VC++6.0下运行如下程序:(我新建的工程选“win32 console application”,文件是“C++ source file" .
#include"stdafx.h"#include<iostream.h>intmain(intargc,char*argv[]){intnum1=0,num2=0;/...
#include"stdafx.h"
#include<iostream.h>
int main(int argc,char*argv[])
{
int num1=0,num2=0; //定义全局变量num1,num2,并赋予初值
num1++; num2++; //将num1加1后赋给num1,将num2加1后赋给num2
cout<<"num1="<<num1<<","<<"num2="<<num2<<endl; //输出num1,num2的值
{
float num1=7.7 //定义局部变量num1
num1++;num2++;
cout<<"num1="<<num1<<","<<"num2="<<num2<<endl;
}
num1++; num2++;
cout<<"num1="<<num1<<","<<"num2="<<num2<<endl;
return 0;
}
按编译时,出现如下错误:Cannot open include file: 'stdafx.h': No such file or directory。
原因是什么???? 展开
#include<iostream.h>
int main(int argc,char*argv[])
{
int num1=0,num2=0; //定义全局变量num1,num2,并赋予初值
num1++; num2++; //将num1加1后赋给num1,将num2加1后赋给num2
cout<<"num1="<<num1<<","<<"num2="<<num2<<endl; //输出num1,num2的值
{
float num1=7.7 //定义局部变量num1
num1++;num2++;
cout<<"num1="<<num1<<","<<"num2="<<num2<<endl;
}
num1++; num2++;
cout<<"num1="<<num1<<","<<"num2="<<num2<<endl;
return 0;
}
按编译时,出现如下错误:Cannot open include file: 'stdafx.h': No such file or directory。
原因是什么???? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询