cin>>c && c!='?' 不AC嘞
#include <iostream> #include <stdio.h> using namespace std; int main(){ char c; int letter, digit, others; letter = digit = others = 0; while(cin>>c&&c!='?'){ if((c<='z'&&c>='a')||(c<='Z'&&c>='A')) letter++; else if(c<='9' && c>='0') digit++; else others++; } cout<<"Letters="<<letter<<endl; cout<<"Digits="<<digit<<endl; cout<<"Others="<<others<<endl; return 0; }
请问以上代码咋不通过嘞?
while(cin>>c&&c!='?') 和
while((c=getchar())!='?') 有啥差别吗