怎样输出第一个字符
#include<stdio.h>int main()
{
char ch;
int count;
while((ch=getchar())=EOF)
{
count=0;
while((ch=getchar())!='\n')
{
if((ch>='0'&&ch<='9')||(ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))
count++;
}
printf("%d",count);
}
return 0;
}
#include<stdio.h>
int main(void)
{
char ch , ah ;
int count = 0 ;
while((ch = getchar())!= EOF && ch != '\n')
{
if((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
{
if (count == 0) ah = ch ;
count ++ ;
}
}
printf("%c\n" , ah) ;
printf("%d" , count) ;
}
页:
[1]