Advertisement
Guest User

Untitled

a guest
Apr 28th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4. using  namespace std;
  5. int main()
  6. {
  7.     int a=0;
  8.     int b=0;
  9.     int maxLoopsNumber=0;
  10.     string str;
  11.  
  12.     getline (cin,str);
  13.     stringstream(str) >> a;
  14.  
  15.     getline (cin,str);
  16.     stringstream(str) >> b;
  17.  
  18.     getline (cin,str);
  19.     stringstream(str) >> maxLoopsNumber;
  20.  
  21.     int m = 58;
  22.     int n = 33;
  23.     int x = 1;
  24.     int y = 1;
  25.    
  26.     for (int i = 0; i < maxLoopsNumber; i++)
  27.     {
  28.         if (x >= a && y > b)
  29.         {
  30.             break;
  31.         }
  32.         if (x > a)
  33.         {
  34.             x = 1;
  35.         }
  36.         if (y > b)
  37.         {
  38.             y = 1;
  39.             x++;
  40.         }
  41.         if (n > 47)
  42.         {
  43.             n = 33;
  44.         }
  45.         if (m > 64)
  46.         {
  47.             m = 58;
  48.         }
  49.         char mChar = (char)m;
  50.         char nChar = (char)n;
  51.         cout <<  nChar << mChar << x << y << mChar << nChar << "|";
  52.        
  53.         m++;
  54.         n++;
  55.         y++;
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement