Problem D: 零起点学算法106——首字母变大写

Time Limit: 1 Sec  Memory Limit: 64 MB
Submit: 18252  Solved: 5211

Description

输入一个英文句子,将每个单词的第一个字母改成大写字母。

Input

输入数据包含多个测试实例,每个测试实例是一个长度不超过100的英文句子,占一行。

Output

请输出按照要求改写后的英文句子。

Sample Input

i like acm
i want to get an accepted

Sample Output

I Like Acm
I Want To Get An Accepted
代码如下:
#include<bits/stdc++.h>
using namespace std; int main(){
char a[101];
while(gets(a)!=NULL){
a[0]=toupper(a[0]);
for(int i=1;i<(int)strlen(a);i++){
if(a[i]==' ') a[i+1]=toupper(a[i+1]);
}
printf("%s\n",a);
} return 0;
}

ZSTUOJ刷题11:Problem D.--零起点学算法106——首字母变大写的更多相关文章

  1. Problem G: 零起点学算法106——首字母变大写

    #include<stdio.h> #include<string.h> int main(void) { ]; int i,k; while(gets(a)!=NULL) { ...

  2. Problem F: 零起点学算法101——统计字母数字等个数

    #include<stdio.h> #include<string.h> int main(){ ]; while(gets(str)!=NULL){ ,b=,c=,d=; ; ...

  3. Problem H: 零起点学算法109——单数变复数

    #include <stdio.h> #include<string.h> int main(void) { int n; ]; scanf("%d",&a ...

  4. Problem D: 零起点学算法95——弓型矩阵

    #include<stdio.h> #include<string.h> int main() { ][]; while(scanf("%d%d",& ...

  5. Problem F: 零起点学算法42——多组测试数据输出II

    #include<stdio.h> int main() { ; while(scanf("%d%d%d",&a,&b,&c)!=EOF) { ...

  6. Problem E: 零起点学算法34——3n+1问题

    #include<stdio.h> #include<math.h> int main() { int n; n<=pow(,); ; scanf("%d&qu ...

  7. Problem K: 零起点学算法107——统计元音

    #include<stdio.h> int main() { int n; ]; while(scanf("%d%*c",&n)!=EOF) { while(n ...

  8. Problem J: 零起点学算法105——C语言合法标识符

    #include<stdio.h> #include<ctype.h>//调用isalpha函数 int main() { int n; ]; while(scanf(&quo ...

  9. Problem I: 零起点学算法104——Yes,I can!

    #include<stdio.h> int main() { ]; while(gets(a)!=NULL) { printf("I am "); printf(&qu ...

  10. Problem H: 零起点学算法103——查找最大元素

    #include<stdio.h> #include<string.h> int main() { ]; while(gets(a)!=NULL) { ]; ;a[i]!='\ ...

随机推荐

  1. java方法的笔记

    方法 方法的概念 方法(method)是将具有独立功能的代码块组织成为一个整体,使其具有特殊功能的代码集 注意: 方法必须先创建才可以使用,该过程成为方法定义 方法创建后并不是直接可以运行的,需要手动 ...

  2. python学习——set集合,sorted函数

    题目: 输入a,b班的名单,并进行如下统计. 输入格式: 第1行::a班名单,一串字符串,每个字符代表一个学生,无空格,可能有重复字符.第2行::b班名单,一串字符串,每个学生名称以1个或多个空格分隔 ...

  3. CPU 相关知识

    参考:https://blog.csdn.net/andy572633/article/details/46834155 lscpu 查看到部分CPU不在线 CPU(s) 4 On-line CPU( ...

  4. gcc 中weak弱函数

    1.weak弱函数 weak 函数用于定义变量或者函数.弱函数一般用于多个模块间的交互接口 int __attribute__((weak)) test_lib_a(int a, int b) { p ...

  5. windows下MinGW64编译环境设置

    windows下MinGW64编译环境设置 1. MinGW 介绍 MinGW 的全称是:Minimalist GNU on Windows .是将经典的开源 C语言 编译器 GCC 移植到了 Win ...

  6. TIDB-DM数据迁移第三部(集群管理)

    1.对现在 dm 集群进行缩容,将 free 状态的 worker 下线. tiup dm display dm-test 查看 free 状态节点 tiup dm scale-in dm 172.1 ...

  7. Net Core 3.1 ONVIF 操控海康摄像头

    先给出实现的代码 https://github.com/lu1770/onvif-client.git 也可以通过安装包来使用功能 dotnet add package Onvif 基本用法 Agen ...

  8. C语言学习记录(一)

    C语言学习记录(一) 一.知识要点(程序设计概述) 1.程序与程序设计语言 概念:程序就是给计算机下一系列指令,使其完成任务.而编写这些指令就是程序设计. 程序设计语言 第一代程序设计语言(1GL): ...

  9. MySQL学习日志(建设中)

    1.前期准备 1.1软件需求 mysql8.0 Connector/J 8.0.31 workbench(懒得放链接自行百度吧) 一定不要下5.5或更低版本的,我折磨了宝贵的一上午,低版本bug很多, ...

  10. Comparison Theorem in Riemannian geometry

    Given $p\in M$, locally, there exists a diffemorphism of $T_M$ and $B_r(p)\subset$, this is the most ...