Actually, my code wasn't intended to be used, I just wanted to give lilhawk a little clue (though I don't know what does exactly he want)... I'd never use that loop without a break; statement in it, otherwise it's useless.
Printable View
Actually, my code wasn't intended to be used, I just wanted to give lilhawk a little clue (though I don't know what does exactly he want)... I'd never use that loop without a break; statement in it, otherwise it's useless.
>> They are only very rarely used as you did.
Infinite loops are used all the time. The code was fine as an example.
No. It was not. As the cin.get() at the end so very well shown it was a bad example. It was flawed. It was an infinit loop and it was badly implemented. Nice to see you find this type of code "fine as an example", Daved. Will keep that in mind.
I left cin.get() there from another program with no loops at all, just forgot to take it out, forgive me my laxity :p
>> Nice to see you find this type of code "fine as an example", Daved. Will keep that in mind.
That is so dumb. Are you even reading this thread? It reminds me of someone closing their eyes and replying to random bits of conversation as they're being pushed around.
I can't even see why an unconditional [while(1), for(;;)] loop is poor style if you have a condition inside of it, uh, making it conditional?
Mario, please stop. I find your attitude to be obnoxious, but that's irrelevant. When you make claims about the quality of someone's code, it's your responsibility to explain why and offer alternatives, as well as defend yourself in a civil manner against differing opinions. If you can't offer constructive criticism, or accept constructive criticism, be silent or you'll be silenced.
ok theres a row a letters starting at a at from the top of the screen to the bottom...after half a second it changes to the next letter etc when it find the letter it wants it goes a space forward and the process repeats
actually i may be able to do this with the time library and and some simple string function
can i see some tutorials on the two if know any
Oh. I think I know what you want: first print a row os 'a', when the last 'a' in that row is printed move the cursor to the right a little bit and print a row of 'b's. when the last 'b' is printed, move the cursor to the right again and print a row of 'c's. That process continues until the screen is filled with letters.
If that is what you want, it will be fairly simple if you using Turbo C compiler because it supports the gotoxy() function, which moves the text cursor to any desired location. The program will be a bit more difficult using MS-Windows console program and a 32-bit compiler such as Dev-C++ because they do not support gotoxy(), but there are win32 api functions that will perform that task. using a *nix compiler on *nix box, use curses library to do it.
And if it doesn't support the gotoxy, you can always make one, like so -
Just put it in a loop or something. I put a timing class I made here. It's pretty straightforward to use.Code:void GotoXY ( int X, int Y )
{
COORD Cursor_Position;
Cursor_Position.X = X;
Cursor_Position.Y = Y;
SetConsoleCursorPosition( GetStdHandle ( STD_OUTPUT_HANDLE ), Cursor_Position );
}
Or you could just use curses and make it cross platform for fun :D.
I'm sure you do. And I'm sure it is as irrelevant as the need for you to say you find it obnoxious.Quote:
Originally Posted by Prelude
Meanwhile it's a good thing we all finally understand what the OP wanted.
>Do please read the tutorials on this website about for loops.
That's the most common way to do an infinite loop in C++ or C.
Then a fight broke out.
This is a loop that never ends.Code:for( ; ; )
{
// do something
}
Yes it goes on and on my friend.
Some processors started running it,
Not knowing what it was,
and they'll continue running it forever just because.
Now to get back on topic. I'm a bit disappointed in my fellow compatriots. We're arguing about loops. ...again.
>We're arguing about loops. ...again.
Darn, did I miss the last one?:mad:
no thats not what i want what i mean is like it keeps going down the alphabet like for a name and half second it changes the letter