主站
DreamJudge
院校信息
专业题库
模拟考试
机试真题
专业课程
讨论区
兑换中心
登录
注册
发布
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
huanghu
2024年3月16日 15:00
字符个数 题解:C++
P1042
回复 0
|
赞 0
|
浏览 179
#include<stdio.h> #include<string> #include<iostream> using namespace std; int main(){ int ch=0,shu=0,kong=0,el=0; string str; getline(cin,str); int len = str.length(); for(int i = 0; i<len; i++){ if(str[i]>='0'&&str[i]<='9'){ shu++; ...
小酒
2024年3月15日 15:33
字符个数 题解:
P1042
回复 0
|
赞 0
|
浏览 93
1042解题思路 #include <bits/stdc++.h> using namespace std; int main() { int num=0,str=0,zero=0,other=0; char a[105]={0}; gets(a); int l=strlen(a); for(int i=0;i<l;i++) { if(a[i]>='0'&&a[i]<='9') num++; else { if(a[...
williams
2024年3月6日 11:00
字符个数 题解:c
P1042
回复 0
|
赞 0
|
浏览 273
#include <stdio.h> #include <stdbool.h> #include <math.h> #include <string.h> int main(void) { char s[1000]; int eng=0,math=0,space=0,c=0; gets(s); for(int i=0;i<strlen(s);i++){ if((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&...
活着的传奇
2023年8月21日 10:17
字符个数 题解:
P1042
回复 0
|
赞 0
|
浏览 425
#include<bits/stdc++.h> using namespace std; int main(){ char a; int x =0,b = 0,c = 0,d =0; while((a =getchar())!='\n') { if(a>='0'&&a<='9') x++; else if((a>='a'&&a<='z')||(a>='A'&&a<='Z')) b++; else if(a...
dongqing
2023年7月27日 12:48
字符个数
P1042
回复 0
|
赞 1
|
浏览 508
string s; getline(cin,s); 采用这种输入方式可以输入空格 #include<bits/stdc++.h> using namespace std; int main(){ string s; int zimu=0,shuzi=0,kongge=0,qita=0; getline(cin,s); for(int i=0;i<s.size();i++) { if(s[i]>='a'&&s[i]<='z') ...
Hegel
2023年3月24日 19:28
统计字符串s中字母数字空格以及其他字符的个数
P1042
回复 0
|
赞 0
|
浏览 1.7k
#include <iostream> #include <string> using namespace std; int main() { int e=0,n=0,b=0,o=0; string s; getline(cin,s); for(int i=0;i<s.size();i++){ if(s[i]>='a'&&s[i]<='z'||s[i]>='A'&&s[i]<='Z') e++; else if(s[i]>='0'&&s...
零壹
2023年3月23日 11:34
c-gets()
P1042
回复 0
|
赞 0
|
浏览 2.0k
注意用gets()来接收字符串即可,因为用scanf()的话,输入过程中有空格会很麻烦 #include<stdio.h> #include<string.h> int main(){ char str[100]; gets(str); int len=strlen(str); int p=0,q=0,t=0,m=0; for(int i=0;i<len;i++){ if((str[i]>='a'&&str[i]<='z')||(str[i]>='A'&&...
A1120161820
2020年3月25日 11:18
字符个数(c++)
P1042
回复 0
|
赞 0
|
浏览 9.3k
#include<iostream> #include<cstring> using namespace std; const int M = 1024; int main() { char line[M]; cin.getline(line, M); int num[4]; memset(num, 0, sizeof(num)); int i = 0; while (line[i]) { if (line[i] >= 'a' && line[i] <= 'z' || line[i] >...
此心安处是吾乡
2020年3月16日 00:05
字符个数统计
P1042
回复 0
|
赞 0
|
浏览 8.7k
#include <iostream> #include <string> using namespace std; int main() { string str; getline(cin, str); int a=0, b=0, c=0, d=0; int n = str.length(); for (int i = 0; i < n; i++) { if ((str[i] >= 'a' && str...
myhy001
2019年12月21日 14:31
TA zai 跟我开玩笑 没ch=a[i]就是不给通过
P1042
回复 0
|
赞 1
|
浏览 9.4k
#include<stdio.h> int main() { char ch,a[100]; int zimu=0,shuzi=0,kongge=0,qita=0,i=0; gets(a); while(a[i]!='\0') { ch=a[i]; if(ch>='A'&a...
题目
字符个数
题解数量
10
发布题解
热门题解
1
字符个数
2
TA zai 跟我开玩笑 没ch=a[i]就是不给通过
3
字符个数 题解:C++
4
统计字符串s中字母数字空格以及其他字符的个数
5
字符个数(c++)
6
c-gets()
7
字符个数 题解:
8
字符个数 题解:c
9
字符个数统计
10
字符个数 题解: