scanf函数的用法
#include <stdio.h>
main()
{
char ch,nch; /* */
int count; /* */
int k; /* */
printf("Please input a string with a # in the end.\n");
scanf("%c",&ch); /* */
while(ch != '#') /* */
{
if(ch >= '0' && ch <= '9')
{
/* */
count = ch-'0'+1; /* */
scanf("%c",&nch); /* */
for(k=0;k<count;k++) /* */
printf("%c",nch);
}
else
printf("%c",ch); /* */
printf(" "); /* */
scanf("%c",&ch); /* */
}
printf("#\n"); /* */
}
scanf("%c",&nch); 这一句scanf函数怎么运行的 他还是要手动输入字符进去吗
main()
{
char ch,nch; /* */
int count; /* */
int k; /* */
printf("Please input a string with a # in the end.\n");
scanf("%c",&ch); /* */
while(ch != '#') /* */
{
if(ch >= '0' && ch <= '9')
{
/* */
count = ch-'0'+1; /* */
scanf("%c",&nch); /* */
for(k=0;k<count;k++) /* */
printf("%c",nch);
}
else
printf("%c",ch); /* */
printf(" "); /* */
scanf("%c",&ch); /* */
}
printf("#\n"); /* */
}