Thursday 28 June 2012

Lecture: 105


                                                Lecture 105

//Draws a checkerboard on the screen
#include <iostream>
#include <conio.h>
using namespace std;
 main ()
{  
        int x,y;
        y=1;
        while(y<9)
           {
              x=1;   
              while(x<9)
                 {
                 if((x+y)%2==0)
                     cout<<"\xDB\xDB";
                 else
                     cout<<"  ";
                 x++;
                 }   
               cout<<endl;                       
               y++;
           }

  getch();
  return 0;
}

Code view in dev compiler:

Compile the program Ctrl+F9

      Run program Ctrl+F10