2024年计算机等级考试(二级C语言程序设计)经典试题及答案一(7月2日)
2024/7/2
来源:易考吧
导语
2024年计算机等级考试(二级C语言程序设计)经典试题及答案一,更多及模拟试题,请访问易考吧计算机等级考试网
2024年计算机等级考试(二级C语言程序设计)经典试题及答案一
1). 要求通过while循环不断读入字符,当读入字母N时结束循环。若变量已正确定义,以下正确的程序段是( )
A.while(ch=getchar()==″N″) printf(″%c ″,ch);
B.while((ch=getchar())==′N′) printf(″%c ″,ch);
C.while((ch=getchar())!=′N′) printf(″%c ″,ch);
D.while(ch=getchar() =′N′) printf(″%c ″,ch);
正确答案:C
1). 要求通过while循环不断读入字符,当读入字母N时结束循环。若变量已正确定义,以下正确的程序段是( )
A.while(ch=getchar()==″N″) printf(″%c ″,ch);
B.while((ch=getchar())==′N′) printf(″%c ″,ch);
C.while((ch=getchar())!=′N′) printf(″%c ″,ch);
D.while(ch=getchar() =′N′) printf(″%c ″,ch);
正确答案:C
