JOHNYTHEWINNER

Building - numbers

Feb 15th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. # include <iostream>
  2. using namespace std;
  3. #include <iomanip>
  4. #include <math.h>
  5. #include <cmath>
  6. #include <string>
  7.  
  8. int main()
  9. {
  10.     int floors;
  11.     cin >> floors;
  12.     int rooms;
  13.     cin >> rooms;
  14.     int counter = floors;
  15.     char letter;
  16.     while (counter > 0) {
  17.         if (floors == 1) {
  18.             letter = 'L';
  19.             for (int i = 0; i < rooms; i++) {
  20.                 cout << letter << counter << i << " ";
  21.             }
  22.             break;
  23.         }
  24.         if (counter == floors) {
  25.             letter = 'L';
  26.             for (int i = 0; i < rooms; i++) {
  27.                 cout << letter << counter << i << " ";
  28.             }
  29.             counter -= 1;
  30.         }
  31.         cout << endl;
  32.         if (counter % 2 == 1) {
  33.             letter = 'A';
  34.             for (int i = 0; i < rooms; i++) {
  35.                 cout << letter << counter << i << " ";
  36.             }
  37.         }
  38.         else {
  39.             letter = 'O';
  40.             for (int i = 0; i < rooms; i++) {
  41.                 cout << letter << counter << i << " ";
  42.             }
  43.         }
  44.         counter -= 1;
  45.     }
  46.     return 0;
  47. }
Add Comment
Please, Sign In to add comment