timbo,you try the following code.
Code:
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int number =0,h=0,width=0, setw=0;
char symbol = '\0', answer;
while(1)
{
cout << "Please choose a letter that corresponds to the shape of your choosing \n";
cout << "A. triangle " << endl;
cout << "B. upside down triangle " << endl;
cout << "C. rectangle " << endl;
cout << "D. plus sign " << endl;
cout << "E. quit " << endl;
cin >> symbol;
switch (symbol)
{
case 'a':
case 'A':
cout << "Please choose an odd number 3-9 to calculate width and height of your choosing\n";
cin >> number;
while(number!=3 && number!=5 && number!=7 && number!=9)
{
cout << "You have chosen Invalid Number\n";
cout << "Please choose an odd number 3-9 to calculate width and height of your choosing\n";
cin >> number;
}
cout << "Thank you, you have chosen triangle and " << number << " for height and width" << endl;
cout << "Please enter a symbol to design your shape. " << endl;
cin >> symbol;
cout << '\n';
for(int i=0; i<number; i++)
{
for(int y=-1; y<i; y++)
cout << symbol;
cout << "\n";
}
while(1)
{
cout << '\n' << "Do you wish to continue: (y/n) " << endl;
cin >> answer;
if(answer=='y' || answer=='Y')
break;
else if(answer=='n'||answer=='N')
{
cout << "Thank You For Your Time " << endl;
return 0;
}
else
cout << "Please choose a valid option.Either y or n.";
}
break;
case 'e':
case 'E':
exit(0);
default:
cout << "Please Choose a valid symbol between 'A' and 'E' " << endl;
}
}
return 0;
}