diff --git a/pattern4.cpp b/pattern4.cpp index fd1a517..28a9854 100644 --- a/pattern4.cpp +++ b/pattern4.cpp @@ -4,7 +4,9 @@ *** * */ - +// nRows => number of rows +// nSpace => number of space between two stars +//symbol => if want unique symbool then can provide otherwise it will take astrik/star #include using namespace std; @@ -20,12 +22,22 @@ int main() { } int nSpace=0; + char symbol = "*"; + char ans = "n"; + cout<<" \n Do you want some symbol, By default its astrik/star (y/n) : "; + cin>>ans; + if(ans == "y" || ans == "Y" || ans == "yes" || ans == "YES") + { + cout<<"\n Enter the symbol for pattern, By default its star/astrik "; + cin>>symbol; + } + for (int i=nRows; i>=1; i--) { for (int k=nSpace; k>=1; k--) { cout << " "; } for (int j=(2*i-1); j>=1; j--) { - cout << "*"; + cout << symbool; } cout << "\n"; nSpace++;