首页
DreamJudge
院校信息
专业题库
模拟考试
机试真题
上岸课程
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
Kuze606
2025年3月22日 17:50
字符分类 题解(C):
P1016
回复 0
|
赞 1
|
浏览 95
#include<stdio.h> #include<stdlib.h> #include<string.h> #define MAXSIZE 100 int main(){ char str[MAXSIZE],ch[MAXSIZE],num[MAXSIZE],other[MAXSIZE]; gets(str); int len=strlen(str); int i,c=0,n=0,o=0; for(i=0; i<len; i++){ if((str[i]<='Z'&&str[i]&...
yb5942
2025年3月21日 17:10
字符分类 题解:
P1016
回复 0
|
赞 1
|
浏览 67
#include <bits/stdc++.h> using namespace std; //暴力 int main() { char arr[150]={0}; cin>> arr; char c[150],f[150],s[150]; int i=0,j=0,k=0,h=0; while (arr[i]!=0){ if(arr[i]>='0'&& arr[i]<='9'){ f[k++]=ar...
blackbook537
2025年3月15日 21:28
字符分类 题解:
P1016
回复 0
|
赞 5
|
浏览 198
#include<stdio.h> #include<string.h> int main(){ char s[1000]; scanf("%s",&s); int len = strlen(s); char a[1000],b[1000],c[1000]; int j,k,u; &nbs...
阿灿
2025年3月15日 04:11
字符分类 题解:
P1016
回复 0
|
赞 1
|
浏览 102
#include<bits/stdc++.h> using namespace std; int main(){ string input,z,num,fu; cin>>input; for(char c:input){ if(c>='A'&&c<='Z'||c>='a'&&c<='z'){ z.push_back(c); }else if(c>='0'&&c<='9'){ num.push_back(c); }else{ fu.p...
Candour
2024年4月20日 16:06
字符分类 题解:
P1016
回复 0
|
赞 10
|
浏览 756
#include<bits/stdc++.h> using namespace std; int main() { string str; getline(cin, str); string num, c, others; for(int i = 0; i < str.size(); i ++) { if(str[i] >= '0' && str[i] <= '9') num += str[i]; ...
20082123
2024年3月28日 16:55
字符分类 题解:
P1016
回复 0
|
赞 3
|
浏览 614
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; char a[105]={0}; char b[105]={0}; char c[105]={0}; int j=0,k=0,l=0; ...
Djiangxu
2024年3月24日 16:36
字符分类 题解:挺适合拿来练习结构体的应用哒。
P1016
回复 0
|
赞 0
|
浏览 681
解题思路: (1)有三种类型的字符需要分类,我们可以定义三个数组,为了避免某一种类型的字符数量可能独占100,所以需要将定义的三个类型的数组长度设置为100; (2)定义完数组后,还需要用一个变量来记录数组下标,表示归类长度,用于输出; (3)判断输入字符类型,第一类是字母,大写字母或者小写字母;第二类是数字,0~9;第三类则不是字母也不是数字。 代码如下:希望对你有所帮助~~ #include<iostream> using namespace std; void judge(char cr); struct str{ ...
flipped
2024年3月15日 17:01
字符分类 题解:C
P1016
回复 0
|
赞 12
|
浏览 1.0k
#include <stdio.h> #include <string.h> int main() { char s[105]; gets(s); int l = strlen(s); for (int i = 0; i < l; i++)//先打印输出字母 { if ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z')) ...
小酒
2024年3月15日 15:30
字符分类 题解:
P1016
回复 0
|
赞 1
|
浏览 681
1016解题思路 #include <bits/stdc++.h> using namespace std; int main() { char a[105]={0};//输入字符且保存字母 char b[105]={0};//保存数字 j char c[105]={0};//保存其他字符k gets(a); int l=strlen(a); int j=0,k=0,i=0; for(i=0;i<l;i++) { if(a[i]>='0'&&a[i]<='9') b[j++]=a...
williams
2024年3月10日 10:51
字符分类 题解:
P1016
回复 0
|
赞 0
|
浏览 812
#include <stdio.h> int main(){ char s[1000],num[1000],z[1000],e[1000]; int count1=0,count2=0,count3=0; scanf("%s",s); for(int i=0;i<strlen(s);i++){ if((s[i]<='z'&&s[i]>='a')||(s[i]<='Z'&&s[i]>='A')) z[count1++] = s[i]; ...
1
2
3
题目
字符分类
题解数量
26
发布题解
在线答疑
热门题解
1
字符分类 题解:C
2
字符分类 题解:
3
字符分类 题解:
4
字符分类 题解:
5
字符分类 题解:
6
字符分类 题解:空间换时间
7
字符分类 题解:
8
字符分类 题解(C):
9
将字符强转成int再根据ASCII码做判断
10
输出字符串中的字母,数字和其他字符