Back to the beginning with do while & bool

it's nearly 4am and I'm trying to implement a bool do while loop so that it can only accept certain keyboard input to exit the loop useing chars, F, B, L, R. The code's borrowed and modified by me(without success) but I must admit I don't really understand the bool reversal with the (!done) bit?
A quick fix would be nice (but I know I'm not getting that) so if someone could give me an explanation of if I even need the reversal (!done) or how it works.
Sorry for any bother but I'm flumoxed!
Here's the code.
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
#include <iostream>
#include <stdlib.h>

using namespace std;
char F;
char R;
char B;
char L;
int main()
{
char get_input = 'z';
bool done = false;
cin >> get_input;
while (!done)
    {
    if get_input == F
    else if get_input == R
    else if get_input == B
    else get_input == L
    done true;
    }
    cout << get_input << endl;

system("PAUSE");	
return 0;
}

Thanks in advance Leppie
! returns the inverted value of the bool it's given. true becomes false and false becomes true, but the variable (if that's what's given) isn't modified.
1
2
3
4
5
if get_input == F
    else if get_input == R
    else if get_input == B
    else get_input == L
    done true;


That's.... 4 semi-colons missing and one = sign missing. That, and I think you're missing some curly brackets around some stuff...
http://cplusplus.com/doc/tutorial/control/

-Albatross
Another suggestion Leppie, read the first 4 chapters before reading the next 4. :)
Topic archived. No new replies allowed.