desislava_topuzakova

05. Character Sequence

Jan 31st, 2022
1,033
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     string text;
  8.     //getline -> имаме интервали
  9.     getline(cin, text);
  10.     //всеки символ от текста
  11.     //всяка позиция в текста -> първата (0) до последната (дължина - 1)
  12.     //повтаряме: взимам всеки символ + печатам
  13.     //начало: 0
  14.     //край: дължина - 1
  15.     //промяна: +1
  16.  
  17.     for (int position = 0; position <= text.length() - 1; position++)
  18.     {
  19.         char currentSymbol = text[position];
  20.         cout << currentSymbol << endl;
  21.     }
  22.  
  23.  
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment