Advertisement
HyperSensualNarwhal

Многоуровневая шахматная доска через if

Dec 9th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using std::cout;
  4. using std::cin;
  5. using std::endl;
  6.  
  7. int main()
  8. {
  9.         for (int size = (setlocale(LC_ALL, "Russian"), cout << "Введите размер: ", cin >> size, setlocale(LC_ALL, "C"), size), i = 0; i < size; i++)
  10.         for (int j = 0; j < size; j++, cout << endl)
  11.             {  
  12.                     for (int k = 0; k < size; k++)
  13.                     {
  14.                         if ((i + k) % 2 == 0)
  15.                         for (int l = 0; l < size; l++) cout << " " << " ";
  16.                         else   
  17.                         for (int l = 0; l < size; l++) cout << (char)223 << " ";
  18.                     }      
  19.             }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement