Tuesday, February 3, 2015

Create box in C++ using For loop

#include<iostream.h>
#include<conio.h>
void main(){
clrscr();
int s;
cout<<"enter the size of box: ";
cin>>s;
for(int i=1;i<=s;i++){
cout<<endl;
for(int j=1;j<=s;j++) {

if(i>1 && i<s && j>=2 && j<s){
cout<<" ";
}
else cout<<"*";
}}
getch();
}



Share this

0 Comment to "Create box in C++ using For loop "