首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
曾不会
2026年1月24日 10:19
首字母大写 题解:
P1240
回复 0
|
赞 4
|
浏览 175
#include <stdio.h> #include <string.h> #include <ctype.h> int is_whitespace(char c) { return c == ' ' || c == '\t' || c == '\r' || c == '\n'; } int main() { char s[110]; while (fgets(s, 110, stdin)...
无名1
2025年9月2日 17:22
首字母大写 题解:C++ 关键在于空白符的判定(两种方法)
P1240
回复 0
|
赞 28
|
浏览 1.2k
#include<bits/stdc++.h> using namespace std; int main(){ string s; while(getline(cin,s)){ if(s[0]>=97&&s[0]<=122){ s[0]-=32; } for(int i=1;i<s.length();i++){ // 判断空白符isspace; // 或者这样写也可以:if(s[i-1]==' '||s[i-1]=='\t'||s[i-1]=='\r'||s[...
cczz
2025年8月5日 20:32
首字母大写 题解(采用stl轻松解决):
P1240
回复 0
|
赞 5
|
浏览 725
#include<bits/stdc++.h> using namespace std; int main(){ char s[105]; gets(s); char before = ' '; for(int i = 0; i < strlen(s); i ++){ char ch = s[i]; if(isspace(before) && !isspace(ch)) s[i] = toupper(ch); before = s[i]; cout << before; } ...
古娜拉黑暗之神
2020年4月17日 10:11
布灵布灵
P1240
回复 1
|
赞 42
|
浏览 11.7k
#include<stdio.h> #include<string.h> int main() { char tem[100]; while(gets(tem) != NULL) &nbs...
西电机试专家
2025年3月11日 17:46
首字母大写 题解:非常好理解
P1240
回复 0
|
赞 38
|
浏览 1.4k
#include <bits/stdc++.h> using namespace std; //注意,题目中说输入字符串,那么可能不止含有字母,所以应先判断是否为字母 int main(){ string s; while(getline(cin,s)){ if(s[0]>='a'&&s[0]<<'z') &...
carrot_huan
2025年3月9日 23:34
首字母大写 题解:
P1240
回复 0
|
赞 5
|
浏览 1.1k
#include<iostream> #include<string> using namespace std; int main() { string str; while (getline(cin, str)) { for (int i = 0;i < str.size();i++) &...
jaygee_
2025年3月6日 18:26
首字母大写 题解:
P1240
回复 0
|
赞 1
|
浏览 1.1k
求助!!!PE了,AC60%哪里还需要改进 #include<bits/stdc++.h> using namespace std; int main() { vector<string> words; string s; while(getline(cin, s)) { string word; int n = s.length(); s[0] = toupper(s[0]); for(int i = 0; i < n; i ++) { ...
shiv15832
2025年3月6日 11:48
首字母大写 题解:
P1240
回复 0
|
赞 23
|
浏览 1.4k
其实很简单的题目,定义一个bool flag表示当前位置需不需要转换大写,默认是需要,因为开头字母需要大写,转换之后flag置否,因为转换后不管是后面是什么都不需要大写(空格,标点,字母,数字),这题比较坑爹的一点是数字后面的字母不需要大写,比如4am不要转4Am,单独加一条判断就行了,如果不加会卡60%。 #include<bits/stdc++.h> using namespace std; #define con 'a'-'A' int main(){ char s[105]; &nb...
cHorizon
2025年3月4日 22:43
P1240 首字母大写 答疑提问:
P1240
回复 1
|
赞 9
|
浏览 1.1k
#include <bits/stdc++.h> using namespace std; char s[105]; int main(){ while(gets(s)){ int ls=strlen(s); int flag=0; for(int i...
Chen沧月有泪
2025年2月14日 11:56
首字母大写 题解:
P1240
回复 0
|
赞 14
|
浏览 1.2k
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string.h> int main() { char s[105]; while (gets(s)) { if (s[0] >= 'a' && s[0] <= 'z') ...
1
2
3
4
...
6
题目
首字母大写
题解数量
57
发布题解
在线答疑
热门题解
1
首字母大写 题解:注意这题目的要求 不是空格后面首字母要大写 是空白符!!!
2
布灵布灵
3
首字母大写 题解:非常好理解
4
首字母大写 题解:
5
首字母大写 题解:C++ 关键在于空白符的判定(两种方法)
6
应对多种情况:单词首字母已经大写、1st这种数字开头的单词等
7
首字母大写 题解:
8
首字母大写 题解:c++
9
首字母大写 题解:好奇怪,同样的数据,dev运行出来的结果就是对的,怎么复制过来就输出结果只有一个首字母不对唉。附上我得程序代码和截图。
10
首字母大写 题解: