我需要帮助来识别我用C编写的程序中的错误.请记住我还在学习C.我正在努力实现我所学到的东西.我的IDE是MS visual studio 2010.
这是程序,程序描述写成评论:
/*The distance between two cities (in km) is input through the keyboard.
Write a program to convert and print this distance in meters, feet, inches and centimeters*/
#include<stdio.h>
#include<conio.h>
//I have used #include<stdio.h> and #include<conio.h> above
int main()
{
float km, m, cm, ft, inch ;
clrscr();
printf("\nEnter the distance in Kilometers:");
scanf("%f", &km );
// conversions
m=km*1000;
cm=m*100;
inch=cm/2.54;
ft=inch/12;
// displaying the results
printf("\nDistance in meters =%f", m);
printf("\nDistance in centimeters =%f", cm);
printf("\nDistance in feet =%f", ft);
printf("\nDistance in inches = %f", inch);
printf("\n\n\n\n\n\n\nPress any key to exit the program.");
getchar();
return 0;
}
Errors:
1>e:\my documents\visual studio 2010\projects\distance.cpp(32): error C2857: '#include' statement specified with the /YcStdAfx.h command-line option was not found in the source file
Run Code Online (Sandbox Code Playgroud)
错误C2857:在源代码中找不到使用/YcStdAfx.h命令行选项指定的'#include'语句
这意味着编译器(VisualStudio 2010)强制包含StdAfx.h,但在源代码中您不包含它.
尝试添加:
#include <StdAfx.h>
Run Code Online (Sandbox Code Playgroud)
在源文件的顶部.
| 归档时间: |
|
| 查看次数: |
9133 次 |
| 最近记录: |