Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "rus");
- bool wasNumber = false;
- string line;
- string words[200];
- cout << "Введите строку: ";
- getline(cin, line);
- line += " ";
- size_t pos = 0;
- int count = 0;
- while ((pos = line.find(" ")) != string::npos)
- {
- words[count] = line.substr(0, pos);
- count++;
- line.erase(0, pos + 1);
- }
- for (string& word : words)
- {
- if (word == "")
- {
- break;
- }
- if (wasNumber == false && word.find_first_not_of("1234567890-") == string::npos)
- {
- wasNumber = true;
- long long number = stoll(word);
- cout << "Числовое слово в кубе: " << number * number * number << endl;
- }
- if (word.length() == 4)
- {
- for (char& ch : word)
- {
- if (ch == 'A')
- {
- ch = 'O';
- }
- }
- cout << word << " ";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement