Thread: non expected output

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    224

    non expected output

    when my program reaches this point it just exits the program after input

    Code:
    cin >> selection;
    	
    	cout<<"1\n";
    	
    	if (selection == ('q' ||'Q'))
    	{
    		cout<<"2\n";
    		QuitGame();
    	}
    	if(selection == ('n' || 'N'))
    	{
    		cout<<"3\n";
    		NewGame();
    	}
    	if (selection == ('l' || 'L'))
    	{
    		cout<<"4\n";
    		Load();
    	}
    it quits right after the 1 is printed but doesnt get any farther

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>if (selection == ('q' ||'Q'))
    should be
    >>if (selection == 'q' || selection == 'Q')
    or there are other versions.

    Next time, C++ code on the C++ forum please...
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    224
    lol sorry about wrong board :P

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help for my output array
    By qwertysingh in forum C Programming
    Replies: 1
    Last Post: 02-17-2009, 03:08 PM
  2. execl()/fork() output
    By tadams in forum C Programming
    Replies: 19
    Last Post: 02-04-2009, 03:29 PM
  3. Replies: 4
    Last Post: 11-30-2005, 04:44 PM
  4. Formatting output into even columns?
    By Uncle Rico in forum C Programming
    Replies: 2
    Last Post: 08-16-2005, 05:10 PM
  5. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 05:27 AM