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

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 .

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.

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)?

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 :)

>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)

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.

What compiler are you using?

The only C++ compiler out there?
Bloodshed

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 :)

So what does Compilers have to do with anything?

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 :)

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

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

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

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 :(

So I can't do it without that function?

So I can't do it without that function?

I didn't say that, did I?

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)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.