問答題
寫出下列程序的輸出結(jié)果。#include<stdio.h>voidmain(){charx;intn=0,k=0;while((x=getchar())!=’#’){//運行時輸入:athefthethethere#switch(x){case’t’:k++;break;case’h’:if(k==1)k++;break;case’e’:if(k==2)k++;break;default:k=0;}if(k==3)n++;}printf("%d\n",n);}
您可能感興趣的試卷
你可能感興趣的試題
1.單項選擇題判斷下面的while循環(huán)體的執(zhí)行次數(shù)()。i=0;k=10;while(i=8)i=k––;
A.8次
B.10次
C.2次
D.無數(shù)次
2.單項選擇題與語句while(!s)中的條件等價的是()。
A.s==0
B.s!=0
C.s==1
D.s=0