摘要: #include <cstdio>#include <cstring>using namespace std;int main (){ int m,num,i,c; char a[502] ,b[502]; scanf("%d" ,&m); gets(a); gets(b); for (i=0 ;i 阅读全文
posted @ 2019-11-30 11:30 小浩浩在此 阅读(86) 评论(0) 推荐(0)
摘要: #include <stdio.h>int main(){ char a[102],b[102]; //定义两个数组 int count=0 ; gets(a); //读入整个字符串 for (int k=0;k<102;k++) { if((a[k]==' ')&&(a[k+1]!=' ')) { 阅读全文
posted @ 2019-11-30 11:14 小浩浩在此 阅读(602) 评论(0) 推荐(0)
摘要: strlen (C/C++语言函数) strlen所作的是一个计数器的工作,它从内存的某个位置(可以是字符串开头,中间某个位置,甚至是某个不确定的内存区域)开始扫描,直到碰到第一个字符串结束符'\0'为止,然后返回计数器值(长度不包含'\0')。 中文名strlen头文件string.h(C)或cs 阅读全文
posted @ 2019-11-30 09:11 小浩浩在此 阅读(1062) 评论(0) 推荐(0)
摘要: //转载 C++中 sprintf函数的用法 1.常用方式 sprintf函数的功能与printf函数的功能基本一样,只是它把结果输出到指定的字符串中了,看个例子就明白了: 例:将”test 1 2”写入数组s中 #include<stdio.h>int main(int argc, char *a 阅读全文
posted @ 2019-11-30 09:09 小浩浩在此 阅读(3175) 评论(0) 推荐(0)
摘要: \\转载 1. 常见用法 sscanf("123456 ", "%s", str); 2. 取指定长度的字符串。如在下例中,取最大长度为4字节的字符串。 sscanf("123456 ", "%4s", str); 3. 取到指定字符为止的字符串。如在下例中,取遇到空格为止字符串。 sscanf(" 阅读全文
posted @ 2019-11-30 09:08 小浩浩在此 阅读(5725) 评论(0) 推荐(0)