C语言程序设计基础 马华 李玉娟 第6章 数组新.pptVIP

  • 7
  • 0
  • 约1.06万字
  • 约 47页
  • 2017-07-06 发布于广东
  • 举报

C语言程序设计基础 马华 李玉娟 第6章 数组新.ppt

6.3.4 字符数组的输入输出 2. 整个字符串输入/输出(%s) 例6.6:将整个字符串输入到数组,再按字符串输出 #include stdio.h void main() { char ch[60]; scanf(%s,ch); printf(%s,ch); } 6.3.5 字符串处理函数(1) 1. 字符串输入函数gets(str) 该函数接收从键盘输入的一个字符串,直到遇到回车符结束,并将字符串存放到由str指定的字符数组中,返回该字符数组str的起始地址。 2. 字符串输出函数puts(str) 该函数从str指定的地址开始,将字符串str 输出到显示器。 例6.7用函数gets和puts对字符串进行输入/输出。 #include stdio.h #includestring.h void main() { char str[100]; /* 定义字符数组str */ printf(Please input string:); gets(str); /* 键盘输入字符串并存放到数组str */ printf(Input string is:); puts(str); /* 输出数组str存储的字符串 */ get

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档