首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
williams
2024年3月6日 11:00
字符个数 题解:c
P1042
回复 0
|
赞 3
|
浏览 1.5k
#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
|
浏览 1.3k
#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
|
赞 2
|
浏览 1.6k
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
|
赞 1
|
浏览 2.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
|
浏览 3.1k
注意用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
|
浏览 11.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] >...
myhy001
2019年12月21日 14:31
TA zai 跟我开玩笑 没ch=a[i]就是不给通过
P1042
回复 0
|
赞 1
|
浏览 10.7k
#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...
此心安处是吾乡
2020年3月16日 00:05
字符个数统计
P1042
回复 0
|
赞 0
|
浏览 10.4k
#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...
1
2
题目
字符个数
题解数量
18
发布题解
在线答疑
热门题解
1
字符个数(C++) 题解:
2
字符个数 题解:我还是慢了
3
字符个数 题解:C++
4
字符个数 题解:
5
字符个数 题解:
6
字符个数 题解:c
7
字符个数
8
统计字符串s中字母数字空格以及其他字符的个数
9
TA zai 跟我开玩笑 没ch=a[i]就是不给通过
10
字符个数 题解: