Sunday 1 July 2012

Lecture: 107


                                                Lecture 107

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

  getch();
  return 0;
}

Code view in dev compiler:

Compile the program Ctrl+F9

      Run program Ctrl+F10