OCAC first summer tournament title F string encryption solution to a problem

String Encryption
original title link: 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 containing a character string that contains only lowercase letters (a length of not more than 1000).
[] Output format
result output encryption.
[1] input sample
ApPLe
[1] output sample
ApPLe
[2] input sample
konjac
[2] output sample
Konjac
[title] analysis
very simple one subject, simply turn to uppercase first letter of both the .
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/ocac/p/11113433.html