The question: Get an integer value from the user to draw a cheassboard on the screen of that specified size. The black squares must be * and with any other chessboard there must always be a *(black square) in the bottom left corner.

PLEASE NOTE: I'm very new to c++ programming.

My problem now is every un-even number it shows the * in the bottom left corner but if i input an even number it gives a blank space(white square) in the lower left corner....?

#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
  int num1;
  int n = 1, k = 1 ;
  cout << "Enter Checkered board size: " ;
  cin >> num1;
  cout << "\n\n";
 
 while(n <= num1)
 {
 k = 1 ;
 if ( n++ % 2 == 0)  cout << ' ' ;
 {
  while(k++ <= num)
  {
  cout<<"* " ;
  }
  cout << "\n\n" ;
 }
 }
  
  cout << "\n\n";
  system("PAUSE");	
  return 0;
}

thnx sorry i didn't see that one. k i fixed it but still didn't solve my problem...

if i put in i.e. 5 it shows:

* * * * *
 * * * * *
* * * * *
 * * * * *
* * * * *

but if i use 6 it shows:

* * * * * *
 * * * * * *
* * * * * *
 * * * * * *
* * * * * *
 * * * * * *

the output i want is like 5 but with even and un-even numbers... i.e.: if i type 6 now i would like to see:

* * * * * *
* * * * * *
 * * * * * *
* * * * * *
 * * * * * *
* * * * * *
This article has been dead for over six months. Start a new discussion instead.