首页 > 试题广场 >

首字母大写

[编程题]首字母大写
  • 热度指数:30388 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 64M,其他语言128M
  • 算法知识视频讲解
对一个字符串中的所有单词,如果单词的首字母不是大写字母,则把单词的首字母变成大写字母。 在字符串中,单词之间通过空白符分隔,空白符包括:空格(' ')、制表符('\t')、回车符('\r')、换行符('\n')。

输入描述:
输入一行:待处理的字符串(长度小于100)。


输出描述:
可能有多组测试数据,对于每组数据,
输出一行:转换后的字符串。
示例1

输入

if so, you already have a google account. you can sign in on the right.

输出

If So, You Already Have A Google Account. You Can Sign In On The Right.
头像 普罗列塔丽亚
发表于 2022-01-15 17:10:06
用双指针步进处理 #include<string> #include<iostream> using namespace std; bool isSpliter(char c){//分隔符可能是tab&n 展开全文
头像 用户抉择
发表于 2021-02-07 20:51:29
#include <stdio.h> #include <string.h> int main(){     int i,len;     char&nb 展开全文
头像 bubble...
发表于 2022-02-22 16:12:49
#include<iostream> #include<string> #include<cstdio> using namespace std; int main() { string str; while(getline(cin,str)) 展开全文
头像 Coming680
发表于 2022-01-25 17:23:06
easy #include<iostream> #include<string> using namespace std; int main() { string str,temp; while (getline(cin, str)) { fo 展开全文
头像 李筱法
发表于 2023-02-18 15:01:09
//描述 //对一个字符串中的所有单词,如果单词的首字母不是大写字母, // 则把单词的首字母变成大写字母。 在字符串中,单词之间通过空白符分隔, // 空白符包括:空格(' ')、制表符('\t')、回车符('\r')、换行符('\n')。 //输入描述: //输入一行:待处理的字符串(长度小于1 展开全文
头像 想去毕业旅行的秋招人不愿吃饼
发表于 2025-03-18 21:46:26
#include <iostream> #include "string" using namespace std; int main() { string s; getline(cin, s); if (s[0] >= 97) { 展开全文
头像 绘海纳百川
发表于 2023-03-15 21:28:32
#include <stdio.h> #include <string.h> #define N 100 char l2u(char c){ //将小写装换成大写 if(c>='a'&&c<='z') return (c-('a'-' 展开全文
头像 上课笑醒
发表于 2023-03-13 14:14:12
#include <iostream> #include <string> #include <cstdio> using namespace std; int main(){ char str2[102] = {0}; string str1; 展开全文
头像 粉詹眉
发表于 2024-02-07 23:57:06
#include <iostream> using namespace std; int main() { string str; getline(cin,str); string res; for(int i=0;i<str.size();i++ 展开全文
头像 粉詹眉
发表于 2024-02-07 23:59:31
#include <iostream> using namespace std; int main() { string str; getline(cin,str); string res; for(int i=0;i<str.size();i++ 展开全文