Friday 3 August 2012

Lecture 130


                                                Lecture 130

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

  getch();
  return 0;
}

Code view in dev compiler:

Compile the program Ctrl+F9

      Run program Ctrl+F10