c++ 输出asc2码

来源:百度知道 编辑:UC知道 时间:2024/06/05 08:26:54
#include<iostream>
#include<conio.h>
using namespace std;

int main()
{
char ch=0;

for(ch; ch<=127;ch++)
{
//if (ch=7)continue;
cout<<ch<<" ";
//if (ch=127)break;
}
为什么把IF注释设为语句是 程序就错了?
getch();
return 0;
}

//if (ch==7)continue;
cout<<ch<<" ";
//if (ch==127)break;
你看还错么?

永远记住 C++中 == 是判断是否等于, 而= 表示赋值

if (ch=127) 其中的判断相等的是==等于,而不是赋值=(一个=号)