标签:style blog http color os io ar 2014
运算顺序有关,详见 运算符优先级
代码1:
#include<iostream> using namespace std; int main() { char c; int m=0; while( c= getchar(c) &&c!=‘\n‘) { m++; cout<<"case:"<<m<<endl; cout<<c<<endl; } return 0; }
代码2:
#include<iostream> using namespace std; int main() { char c; int m=0; while( (c= getchar(c)) &&c!=‘\n‘) { m++; cout<<"case:"<<m<<endl; cout<<c<<endl; } return 0; }
while( c= getchar(c) &&c!='\n')为什么错误,布布扣,bubuko.com
while( c= getchar(c) &&c!='\n')为什么错误
标签:style blog http color os io ar 2014
原文地址:http://www.cnblogs.com/bofengyu/p/3910139.html