当我使用分号字符 (";")/ 时,我的 Visual Studio 2010 不允许编译我的文件/它说有错误。
但不是所有的分号,只是其中一个。
1>------ Build started: Project: waynekwa, Configuration: Debug Win32 ------
1>Build started 7/11/2012 11:58:46 PM.
1>InitializeBuildStatus:
1> Touching "Debug\waynekwa.unsuccessfulbuild".
1>ClCompile:
1> waynekwa.cpp
1>c:\users\asus\documents\visual studio 2010\projects\waynekwa\waynekwa\waynekwa.cpp(6): warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h(304) : see declaration of 'scanf'
1>c:\users\asus\documents\visual studio 2010\projects\waynekwa\waynekwa\waynekwa.cpp(11): error C2059: syntax error : ';'
1>c:\users\asus\documents\visual studio 2010\projects\waynekwa\waynekwa\waynekwa.cpp(11): error C2143: syntax error : missing ';' before ')'
1>c:\users\asus\documents\visual studio 2010\projects\waynekwa\waynekwa\waynekwa.cpp(11): error C2143: syntax error : missing ';' before ')'
1>c:\users\asus\documents\visual studio 2010\projects\waynekwa\waynekwa\waynekwa.cpp(12): error C2143: syntax error : missing ';' before '{'
1>c:\users\asus\documents\visual studio 2010\projects\waynekwa\waynekwa\waynekwa.cpp(27): fatal error C1075: end of file found before the left brace '{' at
'c:\users\asus\documents\visual studio 2010\projects\waynekwa\waynekwa\waynekwa.cpp(3)' was matched
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.14
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
编码:
#include<stdio.h>
int main(void) {
int num,x,y=0;
printf("enter range:");
scanf("%i",&num);
for(x=1;x<=;x++) {
if(num%x==0) {
y++;
}
if(y==2) {
printf("it is prime number.\n");
} else {
printf("it is not prime number.\n");
}
return 0;
}