Lecture 70
//Nested for loop
#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<10;row++)//outer loop
{ for(col=1;col<10;col++)//inner loop
{
COORD c;
c.X=row;
c.Y=col;
SetConsoleCursorPosition(wHnd,c);
cout<<"<Shahid>";
} cout<<endl;
}
getch();
return 0;
}
Code view in dev compiler:
Compile the program Ctrl+F9
Run program Ctrl+F10