Nov 24, 2012 at 7:03am UTC
Here's simple joke program
Can't see why it can't end the loop/
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
#include<iostream>
#include<Windows.h>
using namespace std;
void loading();
int main()
{
cout << "PS3 Emulator " << "\t v.0.3.1b " ;
cout << "Loading \n" ;
loading();
cout << "Win7(no_sp) \n 8 cores detected " ;
Sleep(400);
cout << "\n NvidiaGTX470 detected" ;
Sleep(500);
cout << "\n Loading BIOS \n" <<endl ;
loading();
cout << "\n func_PlayOne (1) \n func_SwitchDriver(dx_11) \n func_ShowPerformance (1)" ;
cout << "\n func_show_PostConfig (0)" ;
cout << "\nDll.precompile" << endl;
loading();
cout << "Loading complete." << endl;
char win = ' ' ;
//request input
//NEVER ENDS THIS
do
{
cout << "\n\tPress 'X' to win." ;
cin >> win;
} while (win != 'x' || win != 'X' );
cout << "\n\tYou won." ;
return 0;
}
void loading()
{
int delay = 2000;
for (; delay > 100; delay -= 200)
{
cout << ". " ;
Sleep(delay);
}
}
Last edited on Nov 24, 2012 at 7:04am UTC
Nov 24, 2012 at 7:05am UTC
I mean, despite i enter x or X
Nov 24, 2012 at 7:06am UTC
What input are you providing that causes it to "not exit"?
Nov 24, 2012 at 7:10am UTC
press 'x' or 'X' , then enter.
What input are you providing that causes it to "not exit"?
i don't understand what you mean.
Last edited on Nov 24, 2012 at 7:11am UTC
Nov 24, 2012 at 7:22am UTC
Ah I see. Check the condition on your while loop. Under what conditions would it be false?
Nov 24, 2012 at 7:31am UTC
Arrrg:) condition is true, While "win" is not literal 'x' , or literal 'X';
so it must be false if win is any other? I just couted win each loop, and "win" contains any literal i enter, but not reacts. I know there is a mistake in condition, i just can't figure it out, lurking web now. Damn it:(
Last edited on Nov 24, 2012 at 7:49am UTC
Nov 24, 2012 at 5:58pm UTC
The problem with you loop condition is that it's true if win is different from either 'x' or 'X'. Unless win can have both values at the same time, this condition will always be true.
Nov 25, 2012 at 1:06am UTC
I'm very thankful for answer. That's hard part to understand for beginner.