Saturday 26 May 2012

Lecture: 78


                                                Lecture 78

//Print diagonal line in the screen
#include <iostream>
#include <conio.h>
using namespace std;
 main ()
{  
        int x,y;
        for(y=1;y<24;y++)
           {
              for(x=1;x<24;x++)
                 if(x==y)
                     cout<<"\xDB";
                 else
                     cout<<"\xB0";
               cout<<endl;                       
           }

  getch();
  return 0;
}

Code view in dev compiler:

Compile the program Ctrl+F9

      Run program Ctrl+F10