Monday 28 May 2012

Lecture: 81


                                                Lecture 81
//Print diagonal line in the screen
#include <iostream>
#include <conio.h>
using namespace std;
 main ()
        int x,y,i,j;
        for(y=1;y<24;y++)
           {
              for(x=1;x<24;x++){
                 if(x==y)
                     cout<<"\xDB";
                 else if(x==2*y)
                     cout<<"\xB1";
                 else  
                     cout<<" ";
                 }   
                 for(i=1;i<3000;i++) //Timer loop                
                     for(j=1;j<7000;j++)                 
                        {}  
               cout<<endl;                      
           }

  getch();
  return 0;
}

Code view in dev compiler:

Compile the program Ctrl+F9

      Run program Ctrl+F10