You are on page 1of 2

#include <iostream> //library for io stream

#include <string> //library for string


using namespace std;
void pattern1(); //function prototype
void pattern2(int k, int l);
void compare(int x, int y);
int main(){
while(1){
int x,y;
cout<<"please enter value of x and y>> ";
cin >> x >>y;
compare(x,y);
system("pause");
system("cls"); //clear screen
}
system("pause");
}
void pattern1(){
int i;
for(i=1; i<6; i++){
for(int j=1; j<6; j++){
cout <<"* ";
}
cout<<endl;
}
}
void pattern2(int k, int l){
int i;
for(i=1; i<k; i++){
for(int j=1; j<l; j++){
cout <<"* ";
}
cout<<endl;
}
}
void compare(int x, int y){
if (x<=y){
int k,l;
cout<<"plese enter your size (k n l)>> ";
cin>>k >>l;
pattern2(k,l);
}
else{
pattern1();
}
}

You might also like