It's still a fairly simple code, just an if else-if else statement inside of a do-while loop.
The do-while loop works just fine, but each of the if statements is supposed to display some text, which they do, but the only display the first line of text with-in the do-while loop
/* mOS Beta v1.0
*
* Developed By: Austin Hoffmaster [deer dance]
*
* Date Began: 22-4-09
* Date Ended: NULL
*
*/
#include <iostream>
#include <cmath>
#include <string>
#include <fstream>
using namespace std;
int main()
{
char x;
do
{
cout << "Enter Command: ";
cin >> x;
if(x = 'HELP')
{
system("CLS");
cout << "\nThis is the help screen." << endl << endl;
}
else if(x = 'DIR')
{
system("CLS");
cout << "\nThis is the Directory Manager." << endl << endl;
}
else if(x = 'SYSINFO')
{
system("CLS");
cout << "\nThis is where the mOS system information will be displayed to you." << endl << endl;
}
} while(x = true);
system("pause");
getchar();
return 0;
}
Everytime I run the program, the do-while loop runs, but regardless of what I input, it spits out this line of text:
cout << "\nThis is the help screen." << endl << endl;
If anyone knows the solution to this problem, your help is much appreciated.
Also, I'm still fairly new to C++, so if there's anything else wrong with my code, please let me know.
Thank you again.

New Topic/Question
Reply



MultiQuote








|