Advertisement
Benjamin_Loison

Ce genre de code mamène ! (Old title) - (Console draws)

May 6th, 2017
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.    int x, y;
  7.    
  8.    cin >> x;
  9.    for(int i = 0; i < x; i++)
  10.       cout << "X";
  11.    cout << endl << endl;
  12.    
  13.    cin >> y; cin >> x;
  14.    for(int i = 0; i < x; i++)
  15.       cout << "#";
  16.    cout << endl;
  17.    for(int i = 0; i < y - 2; i++)
  18.    {
  19.       cout << "#";
  20.       for(int j = 0; j < x - 2; j++)
  21.          cout << " ";
  22.       if(x >= 2)
  23.          cout << "#";
  24.       cout << endl;
  25.    }
  26.    for(int i = 0; i < x; i++)
  27.       cout << "#";
  28.    cout << endl << endl;
  29.    
  30.    cin >> x;
  31.    cout << "@" << endl;
  32.    for(int i = 0; i < x - 2; i++)
  33.    {
  34.       cout << "@";
  35.       for(int j = 0; j < i; j++)
  36.          cout << " ";
  37.       cout << "@" << endl;
  38.    }
  39.    for(int i = 0; i < x; i++)
  40.       cout << "@";
  41. }
  42.  
  43. Input:
  44.  
  45. 15
  46. 5
  47. 12
  48. 6
  49.  
  50. Output:
  51.  
  52. XXXXXXXXXXXXXXX
  53.  
  54. ############
  55. #          #
  56. #          #
  57. #          #
  58. ############
  59.  
  60. @
  61. @@
  62. @ @
  63. @  @
  64. @   @
  65. @@@@@@
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement