zoukankan      html  css  js  c++  java
  • C语言练习笔记更新

    字符串处理函数

    puts()和gets()

    #include<stdio.h>
    void main()
    {
     char str[10];
     gets(str);
     puts(str);
    }

    strcat函数

    其一般形式为strcat(字符数组1,字符数组2)

    =号返回的是=右边的值。

    检查输入有多少个单词:

    #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);
    }

  • 相关阅读:
    css3线性渐变
    php的%s
    面向对象
    excel导入导出
    保存Excel
    保存word
    图片预览
    验证日期输入格式
    级联菜单
    中级前端知识点提要
  • 原文地址:https://www.cnblogs.com/tao560532/p/2335030.html
Copyright © 2011-2022 走看看