1: #include <stdio.h> 2: int main() 3:{ 4: int a=2; 5: int b=6.5 6: for(i=0;i <b;i++) 7: int c="a+sqrt(b);" 8: return 0; 9:} 上述程序在vc2010下的编译结果如下:> ------ Build started: Project: rrrr, Configuration: Debug Win32 ------ > main.cpp > main.cpp(6): warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data > main.cpp(6): error C2143: syntax error : missing ';' before 'for' > main.cpp(6): error C2065: 'i' : undeclared identifier > main.cpp(6): error C2065: 'i' : undeclared identifier > main.cpp(6): error C2065: 'i' : undeclared identifier > main.cpp(7): error C3861: 'sqrt': identifier not found > main.cpp(8): error C2146: syntax error : missing ';' before identifier '; ' > main.cpp(8): error C2065: '; ' : undeclared identifier > main.cpp(8): error C2143: syntax error : missing ';' before '}' ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 引起编译错误的原因是:
A、第五行缺少封号
B、第六行缺少封号
C、第七行有非法字符
D、第七行sqrt缺少头文件
E、第五行变量赋值类型不匹配