C语言第6章ppt教学.pptVIP

  • 4
  • 0
  • 约1.44万字
  • 约 81页
  • 2016-11-06 发布于江西
  • 举报
C语言第6章ppt教学.ppt

7. strlwr函数 其一般形式为:strlwr (字符串) strlwr函数的作用是将字符串中大写字母换成小写字母。 8. strupr函数 其一般形式为:strupr (字符串) strupr函数的作用是将字符串中小写字母换成大写字母。 例6 .8 输入一行字符,统计其中有多少个单词,单词之间用空格分隔开。 6.3.7字符数组应用举例 程序如下: #include stdio.h void main() { char string[81]; int i,num=0,word=0; char c; gets(string); for (i=0;(c=string[i])!=′\ 0′;i++) if(c==′ ′) word=0; else if(word==0) { word=1; num++; } printf(″There are %d words in the line.\n″,num); } 运行情况如下: I am a boy.↙ There are 4 words in the line. 例6.9 有3个字符串,要求找出其中最大者 程序如下: #includestdio.h #includestring.h void

文档评论(0)

1亿VIP精品文档

相关文档