CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <string>
using namespace std;
// declare the variables that will be used
int numOfSpaces, numOfSymbols, maxNumOfSymbols;
const string SPACE = " ";
char myChosenSymbol;
void InputMaxNumberOfSymbols() {
do {
cout << "Enter the maximum number of symbols you want for the triangle (Must be odd): ";
cin >> maxNumOfSymbols;
} while (maxNumOfSymbols % 2 != 1);
cout << endl;
}
void SetValues() {
/*
This function only accepts a single character for the symbol input
The acceptable list of characters are those characters from the ASCII
character list that can be displayed on the screen.
*/
cout << "Enter a single character of your choosing for the triangle: ";
cin >> myChosenSymbol;
cout << endl;
InputMaxNumberOfSymbols();
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run