Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.08 KB | None | 0 0
  1.     #include <iostream>
  2.     #include <unordered_map>
  3.     #include <vector>
  4.     using namespace std;
  5.      
  6.     int main()
  7.     {
  8.      
  9.         vector<char> arr;
  10.         vector<char> arr2;
  11.         char input;
  12.         while (input != '.')
  13.         {
  14.             cin >> input;
  15.             if (input == '.')
  16.             {
  17.                 break;
  18.                 }
  19.             arr.push_back(input);
  20.         }
  21.      
  22.         //abab1bca98abab1. size = 15
  23.         int size = arr.size() / 5; // ==3
  24.         int five = arr.size() / size; // == 5
  25.         // cout << size << '\n';
  26.         // cout << five << '\n';
  27.        
  28.      
  29.        /*here i want to print every 5th part o the input
  30.         for example from this  abab1bca98abab1. i want to print
  31.         abab1
  32.         bca98
  33.         abab1
  34.         */
  35.         for (int i = 0; i < arr.size();)
  36.         {
  37.             for (int j = 0; j < 5;)
  38.             {
  39.                 cout << arr[j];
  40.                  j++;
  41.             }
  42.             i += 5;
  43.      
  44.             cout << '\n';
  45.         }
  46.      
  47.      
  48.             return 0;
  49.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement