Need some assistance with my written C++ code, it doesn't run now anymore!
I have written some C++ code of my own in 'Code Bits' to draw a triangle in the output screen, based off of user input. This code isn't public so here it is: #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(); numOfSpaces = (maxNumOfSymbols - 1) / 2; numOfSymbols = 1; /* The line below is used to prevent the top of the triangle appearing directly below the output string of this method. */ cout << endl; } void OutputSpaces() { for (int a = 1; a <= numOfSpaces; a++){ cout << SPACE; } } void OutputSymbols() { for (int b = 1; b <= numOfSymbols; b++){ cout << myChosenSymbol; } } void AdjustValuesForNextRow() { numOfSpaces -= 1; numOfSymbols += 2; } int main() { //Calling our written methods! SetValues(); do { OutputSpaces(); OutputSymbols(); AdjustValuesForNextRow(); cout << endl; //Shift the output feed to next line } while (numOfSymbols < maxNumOfSymbols); return 0; } Initially the code worked fine, but after changing the while condition in 'int main()' to '<=' causes timeout errors. So, I reverted the condition back to '<' and now the code never executes. Is this a caching error or something else? Please provide suggestions. Thanks!