关於C++ 请问我犯了什麽错了

来源:百度知道 编辑:UC知道 时间:2024/05/16 12:18:00
#include<iostream>
#include<conio.h>
//#include <stdlib.h>
using namespace std;
int AS=0;
int main()
{

cout<<endl<<" 狂 气 格 斗 测试版0.1"
<<endl<<endl<<endl<<"请作出选择:";
cin>>AS;
//clrscr();//清理屏幕第二个方法
//system("cls");//把该语句执行前所产生的输出到显示屏上的东西全部清空
if AS==0 system("cls") ;

return 0;
}

系统给这样的提示
Compiling...
main.cpp
D:\Work\我的作品\game\game01\fighting\main.cpp(15) : error C2061: syntax error : identifier 'AS'
执行 cl.exe 时出错.

fighting.exe - 1 error(s), 0 warning(s)

if AS==0 得加括号 if(AS==0)

if ( AS==0 ) system("cls") ;

应该把
if AS==0 system("cls") ;
中的 AS==0 打上括号....如 (AS==0)

if关键字后面的判断语句要用“()”,加上“()”,就好了,有问题可以随时交流。

加个括号 if(AS==0)

if(AS==0) system("cls") ;