假定输入为”Go west,young man!”,以下程序会产生什么样的输出?#include void main(){char ch;scanf("%c",&ch);while(ch!='g'){printf("%c",ch);scanf("%c",&ch);}}请问为什么在while循环中只执行输出,没执行输入?

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/14 12:28:59
假定输入为”Go west,young man!”,以下程序会产生什么样的输出?#include void main(){char ch;scanf(

假定输入为”Go west,young man!”,以下程序会产生什么样的输出?#include void main(){char ch;scanf("%c",&ch);while(ch!='g'){printf("%c",ch);scanf("%c",&ch);}}请问为什么在while循环中只执行输出,没执行输入?
假定输入为”Go west,young man!”,以下程序会产生什么样的输出?
#include
void main()
{
char ch;
scanf("%c",&ch);
while(ch!='g')
{
printf("%c",ch);
scanf("%c",&ch);
}
}
请问为什么在while循环中只执行输出,没执行输入?

假定输入为”Go west,young man!”,以下程序会产生什么样的输出?#include void main(){char ch;scanf("%c",&ch);while(ch!='g'){printf("%c",ch);scanf("%c",&ch);}}请问为什么在while循环中只执行输出,没执行输入?
哈哈,看来你是初学者啊,没事儿,好好学啊.你输入的是一个字符串.
而%c是字符型,%s是字符串型.所以ch只接收了你一个字符,即‘G’.大些G与小写G的码值不一样(ASCII码,大小写数值相隔32,你可以看看那ASCII表).进入循环后,如果你输入'g',此时ch变成了g,循环就终止了.至于你问的没执行输入我表示你可能弄错了,如果你一个个输,不含g,还是可以输出你所输入的.

C语言问题(假定输入为Go west,young man!)#includeint mian(void){char ch;scanf(%c,&ch);for(ch='$';ch!='g';scanf(%c,&ch))putchar(ch);return 0; } 假定输入为”Go west,young man!”,以下程序会产生什么样的输出?#include void main(){char ch;scanf(%c,&ch);while(ch!='g'){printf(%c,ch);scanf(%c,&ch);}}请问为什么在while循环中只执行输出,没执行输入? Now many young oeople go _______ to beach children there(south-east,north-west)要说为社么 为什么是go west而不是go to west?世界杯主题曲为什么叫go west,这样不对啊.根据语法应该叫go to the west才对啊. 简单的英语习题1.Now many young people go to _____ to teach children there.(north-west,south-west) Now many young people go to________to teach children there.用love咋填用north-west咋填 谁能翻译一下这条俚语“Go west ,young men 谁能翻译一下这条俚语“Go west ,young men 谢谢啦 Now many young people go _________ to teach children there.(south-east,north-west)south-east,north-west两个选一个 一首英文歌,里面连续有好几句“young man”不是go west young man,风云音乐在广告时偶尔出现 too young to go Mr West's son has grown up___a tall young man 在这首歌里GO go west 这首歌的思想 West West West 假定在示波器的输入端输入一个正弦电压,所用水平邵频率为120hz,在屏上出现了3个完整的正弦周期,那么输入电压的频率为多少? 假定在示波器的y轴输入一个正弦电压,所用的水平扫描频率为120hz,在荧光屏上出现三个稳定的正弦波形,那