Getting exercise encrypted string 6 string problem solution problem

Written for: http://codeforces.com/problemset/problem/281/A

Title Description

Lingling want to encrypt a string. Encryption is very simple, is to capitalize the first letter of the string.
Of course slightly, if the first letter of the string beginning capital, you do not carry out any operation a.
Note that in the encryption process, in addition to the first letter, all other elements do not require any conversion.

Input Format

Input contains only one case of letters in the string (length is 1000).

Output Format

The output encrypted.

Sample input

ApPLe

Sample Output

ApPLe

Sample input

konjac

Sample Output

Konjac

Topic analysis

Very simple one subject, simply turn to uppercase first letter of either a.
The first letter to uppercase turn have a more convenient wording is toupper function.
Codes are as follows:

#include <bits/stdc++.h>
using namespace std;

char ch[1010];

int main() {
    cin >> ch;
    ch[0] = toupper(ch[0]);
    cout << ch << endl;
    return 0;
}

Guess you like

Origin www.cnblogs.com/zifeiynoip/p/11450580.html