Problem with the system("CLS") command.
Dec 25, 2012 at 5:04am Dec 25, 2012 at 5:04am UTC
So I put the system("CLS"); command at line 39 to clear the screen before it printed out a new menu in my program. Its saying that 'system' was not declared in this scope. Thanks for any help in advance.
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
#include <iostream>
#include <string>
using namespace std;
//------------------------------------------------------------------------------------------------------------Fucntion Prototypes
void testMainMenu();
void testEasy();
void testNormal();
void testMedium();
void testHard();
//------------------------------------------------------------------------------------------------------------ Main function and beginning screen
int main()
{
string bMenuChoice;
cout << "Dumb Test 6.9" << endl;
cout << "-------------" << endl;
cout << endl;
cout << "Start" << endl;
cout << "Exit" << endl;
cout << endl;
cin >> bMenuChoice;
if (bMenuChoice == "Start" )
{
testMainMenu();
}
else
{
cout << "Thanks for playing!" << endl;
}
}
//------------------------------------------------------------------------------------------------------------Main Menu
void testMainMenu()
{
string difficulty;
system("CLS" );
cout << "Dumb Test 6.9 Main Menu" << endl;
cout << "-----------------------" << endl;
cout << endl;
cout << "Select difficulty: " << endl;
cout << endl;
cout << "Easy" << endl;
cout << "Normal" << endl;
cout << "Medium" << endl;
cout << "Hard" << endl;
cout << endl;
cout << "Difficulty = " ;
cin >> difficulty;
if (difficulty == "Easy" )
{
testEasy();
}
else if (difficulty == "Normal" )
{
testNormal();
}
else if (difficulty == "Medium" )
{
testMedium();
}
else
{
testHard();
}
}
//------------------------------------------------------------------------------------------------------------Easy
void testEasy()
{
cout << "Welcome to the Easy difficulty portion of the test. Good Luck" << endl;
}
//------------------------------------------------------------------------------------------------------------Normal
void testNormal()
{
cout << "Welcome to the Normal difficulty portion of the test. Good Luck" << endl;
}
//------------------------------------------------------------------------------------------------------------Medium
void testMedium()
{
cout << "Welcome to the Medium difficulty portion of the test. Good Luck" << endl;
}
//------------------------------------------------------------------------------------------------------------Hard
void testHard()
{
cout << "Welcome to the Hard difficulty portion of the test. Good Luck" << endl;
}
//------------------------------------------------------------------------------------------------------------End of Hard
Dec 25, 2012 at 7:27am Dec 25, 2012 at 7:27am UTC
You will need to add #include <cstdlib>
to use system commands on certain programs.
Topic archived. No new replies allowed.