链接 题目及楼主的方法
答案的代码

#include<stdio.h>
int main()
{int upper=0,lower=0,digit=0,space=0,other=0,i=0;
 char *p,s[20];
 printf("input string: ");
 while((s[i]=getchar())!='\n')
 {i++;}
 p=&s[0];
 while(*p!='\n')
 {if(('A'<=*p)&&(*p<='Z'))
  ++upper;
  else if(('a'<=*p)&&(*p<='z'))
  ++lower;
  else if(*p==' ')
  ++space;
  else if((*p<='9')&&(*p>='0'))
  ++digit;
  else
  ++other;
  p++;
 }
 printf("upper case:%d	lower case:%d",upper,lower);
 printf("	space:%d	digit:%d	other:%d\n",space,digit,other);
 return 0;
}

运行结果
指针习题8(答案版)
透露一点,,,楼主开始学python了????
下一篇 指针习题10

相关文章:

  • 2022-01-07
  • 2021-04-02
  • 2022-01-07
  • 2021-10-24
  • 2022-12-23
  • 2021-09-02
  • 2021-06-10
  • 2021-05-28
猜你喜欢
  • 2021-08-07
  • 2021-04-04
  • 2021-07-02
  • 2022-12-23
  • 2021-12-26
  • 2021-12-10
  • 2021-05-25
相关资源
相似解决方案