32 lines
679 B
C++
32 lines
679 B
C++
|
#include <iostream>
|
|||
|
#include <string>
|
|||
|
#include <ctype.h>
|
|||
|
#include <windows.h>
|
|||
|
|
|||
|
using namespace std;
|
|||
|
|
|||
|
// Тут не використано <string.h>, бо оновлена <ctype.h> прекрасно працює з цим
|
|||
|
int main() {
|
|||
|
|
|||
|
SetConsoleOutputCP(CP_UTF8);
|
|||
|
|
|||
|
string input;
|
|||
|
cout << "Введіть строку: ";
|
|||
|
getline(cin, input);
|
|||
|
|
|||
|
if (isupper(input[0])) {
|
|||
|
for (int i = 0; i < input.length(); i++) {
|
|||
|
input[i] = toupper(input[i]);
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
for (int i = 0; i < input.length(); i++) {
|
|||
|
input[i] = tolower(input[i]);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
cout << "Result: " << input << endl;
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|