#include "stdafx.h"
#include <iostream>
usingnamespace std;
void mainMenu();
bool stop = false;
int main()
{
if (stop=false)
{
mainMenu();
}
return 0;
}
void mainMenu()
{
int answer;
cout << "Do you want to:\n1: Draw a square?\n2: Do simple calculations?\n3: Draw a line?\n4: Exit\nGive a number:\n";
cin >> answer;
switch(answer)
{
case 4:
stop = true;
break;
default:
mainMenu();
break;
}
}
NOTE: it isn't finished yet, but I don't think that has anything to do with the not showing the menu.
Can someone please tell, or hint, me what I'm doing wrong? ;-)
in C++ operator '=' is an assignment operator and what you need here is equality operator '=='
correct line 10
for more info read here: http://cplusplus.com/doc/tutorial/operators/
Writing stop == false is the same as writing !stop, by the way (! is logical not), so you could also just write if (!stop) // etc because they both just evaluate to true or false. if (stop), if (!stop), if (true), if (false) are all synatactically correct.