|
|
I made a lot of syntax errors, can someone help me correct them? |
|
|
main
function, it is one of the ways of getting a stack overflow.
The function main shall not be used within a program. https://eel.is/c++draft/basic.start.main#3 |
seeplus once wrote: |
---|
any required #define statements std:: headers (eg iostream) c headers (eg conio.h) windows headers (eg windows.h) 3rd party headers user headers |
any required #define statements std:: headers: #include <iostream> #include <iomanip> #include <limits> #include <string> //#include <vector> // <--- For future use. C++ versions of C header files: #include <cctype> // <--- For "std::tolower() and std::toupper()" + others. #include <cmath> #include <ctime> #include <cstdlib> // <--- usually used for "rand()" and "srand" C headers: #include <conio.h> // <--- Not a good example as this should not be used and is not available to everyone. windows headers: #include <windows.h> 3rd party headers Any header files need for the program: #include <algorithm> #include <chrono> #include <random> user headers: Any header file that you write and would be included using double quotes: #include "yourHeader.hpp" |
using namespace std;
I would add to that:protectData
would lead one to think that you are protecting something when you are actually verifying the input, so VerifyData
or VerifyInput
would be a more appropriate name."\n Please enter a number between 0 - 100: "
. This could be interpreted as the numbers between 0 and 100 meaning 1 thru 99 inclusive or some may take it as meaning everything from 0 to 100. You may want to add inclusive after 100."\n Would you like to protect this data? y or n? "
. Again misleading because you are not protecting anything just verifying that it is with the range that you want. Change "protect" to "verify" for a better reading prompt that makes more sense."\n Would you like to go again? y or n? "
and input should be at the end of "main" to control the condition of a do/while or while loop until you enter "n" to end the program.