Hey,
I am trying to create a pattern and can only get the first half going. I have tried negatives, switching up the signs, and nothing worked yet for me. Using Dev C++. An example would be...
#include <iostream>
#include <string>
usingnamespace std;
int main ()
{
int r,l,ll,rr,neg,num=0;//
string output,c;
cout << "\nEnter the amount of lines: "<<endl;
cin >> num;
while (num>=0)
{
cout << "What character will make up the pattern: "<<endl;
cin >>c;
cout <<endl;
cout <<endl;
for (l=0;l<=num;l++)//counts number of lines
{
cout <<endl;
for (r=1;r<=l;r++)//counts number of characters.
{
cout <<c;
}
}
neg=num*-1;
for (ll=0;ll<=num;ll++)//counts number of lines
{
cout <<endl;
for (rr=1;rr<=l;r--)//counts number of characters.
{
cout <<c;
}
}
cout << "\n\nEnter the amount of lines: "<<endl;
cin >> num;
}
cout <<endl;
{
if (num<0)
{
cout << "Bye"<<endl;
system("PAUSE");
}
}}