Hello all,
I am having issues with a homework assignment. My assignment is as follows:
Write a program that uses a loop to display Pattern A below, followed by another loop that displays Pattern B.
Pattern A:
+
++
+++
++++
+++++
++++++
+++++++
++++++++
+++++++++
++++++++++
Pattern B:
++++++++++
+++++++++
++++++++
+++++++
++++++
+++++
++++
+++
++
+
So the above is how the program is supposed to be displayed, but the program I wrote, just basically has Pattern B configured exactly like Pattern A. I am completely stumped and do not know where to go from here, so if I could please get a hint in the right direction, I would greatly appreciate it. Thanks!
//Pattern Displays.
#include<iostream>
using namespace std;
int main()
{
const int columns=9;
const int rows=10;
const int height=10;
cout<<endl<<"============"<<endl;
cout<<endl<<" Pattern A:"<<endl;
cout<<endl<<"============"<<endl;
for(int rows=0; rows<height; rows++)
{
for(int a=0; a<1*rows+1;a++)
cout<<"+";
cout<<endl;
}
cout<<endl<<"=============="<<endl;
cout<<endl<<" Pattern B:"<<endl;
cout<<endl<<"=============="<<endl;
for(int rows=0; height>rows; rows++)
{
for(int b=0; b<1*rows+1;b++)
cout<<"+";
cout<<endl;
}
system("pause");
return 0;
}