Results 1 to 9 of 9

Thread: why skipping?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    why skipping?

    Code:
    cout<<"Enter A Menu Option: ";
    	cin>>menuOpt;
    	while(menuOpt>4 || menuOpt<1)
    	{
    		cout<<"Please Enter A Valid Input (1-4): ";
    		cin>>menuOpt;
    	}
    
    	switch(menuOpt)  //Main game switch statement
    	{
    	case 1:
    			cout<<"1 chosen"<<endl;
    		break;
    	case 2:
    			cout<<"2 chosen"<<endl;
    		break;
    	case 3:
    		cout<<"3 Chosen"<<endl;
    		ShowAbout();
    		break;
    	case 4:
    		cout<<"GoodBye!"<<endl;
    		return 0;
    		break;
    	}
    why does it skip over case 1 - 3? only case 4 works....why?

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    looks ok to me
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Lively Member
    Join Date
    Jan 2000
    Posts
    123
    seems ok to me too... dropped it into my vc++ as a console app with some necessary syntax... and it worked...

    #include <iostream>
    using namespace std;

    int main(void)
    {

    int menuOpt;

    cout<<"Enter A Menu Option: ";
    cin>>menuOpt;
    while(menuOpt>4 || menuOpt<1)
    {
    cout<<"Please Enter A Valid Input (1-4): ";
    cin>>menuOpt;
    }

    switch(menuOpt) //Main game switch statement
    {
    case 1:
    cout<<"1 chosen"<<endl;
    break;
    case 2:
    cout<<"2 chosen"<<endl;
    break;
    case 3:
    cout<<"3 Chosen"<<endl;
    break;
    case 4:
    cout<<"GoodBye!"<<endl;
    return 0;
    break;
    }


    }

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    my VC++ gets very picky sometimes thanks

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    I've restarted VC++ and deleted the original exe so it could fully recompile it...still doesn't work

    attached file uses apstring.h and .cpp

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    it apears only to be linking....how can I fix it so it compiles also

  7. #7
    Hyperactive Member
    Join Date
    Sep 2001
    Posts
    396
    Originally posted by SteveCRM
    it apears only to be linking....how can I fix it so it compiles also
    If it is linking, it means it is compiled alright first.

    I am also find your code is fine, perhaps it is a linker error?
    I'm a VB6 beginner.

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    I fixed it

    it wasn't compiling

    it just said Visual C++------Project Whatever-----------
    Linking.......
    0 Error(s) 0 Warning(s)

  9. #9
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Works fine on my computer.

    Alcohol & calculus don't mix.
    Never drink & derive.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width