Advertisement
Lavig

Другий семестр. Лабораторна робота №3 (Завдання 1)

Feb 18th, 2025
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     SetConsoleOutputCP(1251);
  10.     SetConsoleCP(1251);
  11.     string text{}, result{};
  12.     int i{};
  13.     cout << "Введіть будь-який текст:" << endl;
  14.     getline(cin, text);
  15.     for (i = 0; i < text.size(); i++) {
  16.         if (text[i] != ' ') {
  17.             result += text[i];
  18.         }
  19.     }
  20.     cout << "Текст після видалення пробілів:" << endl << result;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement