0

That's what I have right now.
so there's no other way to do it?
Without the cin>>action inside the loop?

0

Lets see.,

We dont want it to loop infinitely.

We Want it to take input from the user.

So i guess we will have to put a cin in the while loop.

I also think that you should tell more about what you want to do in the program .

0

I'm at Point A, right now, I don't want ot go to Point B, if I can't get point A to work.

0

i GUESS YOU WILL NEED TO cin>>action; inside the while loop.

If you want the loop to run for ever each time taking in C.
U can do this

while(true)
{
cin>>action;
switch(action)
{
case 'c':
//DO something.
}
}

Isn't it better to just use an if-statement here (instead of a switch statement)?

0

I'm at Point A, right now, I don't want ot go to Point B, if I can't get point A to work.

Well, Logically You just cant get out of an infinite while loop without breaking the loop at some point of time.

Without changing the value of ACTION we will be causing an infinite loop.

The Major Problem i think for you is the {ENTER} button after 'c' OR any other character.
I dont know of any way of Avoiding Enter. But remember that i am not perfect as well.
Would you please explain your objectives of this particular project. And What currently is POINT A and POINT B :)

0

>I dont know of any way of Avoiding Enter.
You could use getche() or getch() from conio.h , but remember that it makes your code unportable ...

Edit:: A Borland-style CONIO implementation for the MinGW compiler: http://conio.sourceforge.net/ (though if you only want getch() or getche() you could simply use the ones which are provided in the simple CONIO-implementation which is standard coming with the MinGW-compiler)

0

user determines the amount of restaurants there are.
user determines amount of registers.

Then when C is pressed, that determones the amount of customers.
Then when register is empty, the first customer goes to the register the user types in.

0

The only C++ compiler out there?
Bloodshed

That's not the only one, to be 100% correct: Bloodshed isn't a compiler, you mean MinGW, which is part of the Bloodshed Dev-C++ IDE :)

Other compilers are: Digital Mars, MSVC++, Borland, DJGPP, and much more :)

0

So what does Compilers have to do with anything?

Now I know you're using MinGW, I also know you can use getch() as I'm using MinGW myself :)

0

why am I using getch() a function i never used before again?

So you dont need to press enter everytime you input a character!

0

why am I using getch() a function i never used before again?

I didn't say you have to use it, it's only a suggestion :(

0

So I guess we're back to putting the cin>>action inside the loop.
But is there a way for that not to happen?
I mean because if we do that, CC = 1.
Instead of C = 1.

actually
C
C
(1)
C
C(2)

instead of
C
(1)
C
(2)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.