c语言字符串
YikNjy
难留少年时,总有少年来。
展开
-
读入带空格的字符串
1.(只有c语言中含有get)#include<string.h>#include<stdio.h>int main(){ char s[105]; gets(s); printf("%d",strlen(s)); return 0;}#include <iostream>#include <cstring>using namespace std;int main(){ string a原创 2021-11-24 22:29:02 · 1038 阅读 · 0 评论 -
字符串处理
杭电2093ac码:#include<iostream>#include<algorithm>#include<string.h>using namespace std;int n,m;struct student { char name[12]; int tm; int fs;} xs[100000];int cmp(student a,student b) { if(a.tm!=b.tm) return a.tm>原创 2021-04-06 19:24:32 · 59 阅读 · 0 评论 -
C语言中用scanf连续输入两个字符类型的问题
#include<stdio.h>int main(){ char ch1,ch2; printf(“Input for ch1:/n”); scanf("%c",&ch1); printf(“ch1=%c/n”,ch1); printf(“Input for ch2:/n”); scanf("%c",&ch2); printf(“ch2=%c/n”,ch2);}表面上看这段程序是没有错转载 2021-03-16 20:20:31 · 608 阅读 · 0 评论