Lecture 69
//Nested for loop
//fills square area on screen
#include <iostream>
#include <conio.h>
#include <windows.h>
HANDLE wHnd;
using namespace std;
main ()
{
system("CLS");//Clear screen
int row,col;
for(row=1;row<22;row++)//outer loop
{
for(col=1;col<40;col++)//inner loop
{
COORD c;
c.X=row;
c.Y=col;
SetConsoleCursorPosition(wHnd,c);//gotoxy
cout<<"\xdb";
}
cout<<endl;
}
getch();
return 0;
}
Code view in dev compiler:
Compile the program Ctrl+F9
Run program Ctrl+F10