help me please

This is a discussion on help me please within the C++ Programming forums, part of the General Programming Boards category; Code: #include<iostream> #include<string> using namespace std; int main() { int ice = 20; int fireball = 20; int lighting = ...

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    13

    help me please

    Code:
    #include<iostream>
    #include<string>
    
    using namespace std;
    
    int main()
    {
        int ice = 20;
        int fireball = 20;
        int lighting = 20;
        int water = 20;
        int mana = 80;
        char jutsu;
        
        cout << "Press F for FireBall Jutsu" << endl;
        cout << "Press I for Ice Jutsu" << endl;
        cout << "Press L for Lighting Jutsu" << endl;
        cout << "Press W for Water Jutsu" << endl;
        
        cin >> jutsu;
    
        switch (jutsu)
        {
           case 'F':
                cout << " You Surround Yourself In Fire!" << endl;
                cout << " You Gain 5 str!" << endl;
                break;    
        
            case 'I':
                cout << " You Surround Yourself In Ice!" << endl;
                cout << " You Gain 5 def!" << endl;
                break;    
                
             case 'L':
                cout << " You Surround Yourself In Lighting!" << endl;
                cout << " You Gain 5 sta!" << endl;
                break;    
                
              case 'W':
                cout << " You Surround Yourself In Water!" << endl;
                cout << " You Gain 5 dex!" << endl;
                break;
                
               default:
                       cout << " Thats Not A Valid Jutsu!" << endl;
                       }
                 
                  system("PAUSE");
                       return 0;
                       
                       }

    Ok so this is a little code for a game.Now what im having trouble figuring out is
    how would i add 5 str or dex or chr?
    the 20 is how much mana it takes to activate
    and the 80 is how much mana you have.
    Last edited by Darkozuma; 07-25-2008 at 05:23 PM.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    >> how would i add 5 str or dex or chr?
    You say that as though it means something. Add them to what? (Or alternatively, do you mean add five to them, whatever they are.) If you have something, and you want to add five to it, you do whatever += 5.

  3. #3
    Registered User
    Join Date
    Jul 2008
    Posts
    13
    Quote Originally Posted by tabstop View Post
    >> how would i add 5 str or dex or chr?
    You say that as though it means something. Add them to what? (Or alternatively, do you mean add five to them, whatever they are.) If you have something, and you want to add five to it, you do whatever += 5.
    Well see when you Activate A jutsu Its going to cost mana , tahts what i dont get how to do.

    I edited my coding please take a second look If you dot mind=)

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    So then presumably you only want to do whatever it is you're doing if there's enough mana, so you would need to check first. Then deduct from mana.

  5. #5
    Registered User
    Join Date
    Jul 2008
    Posts
    13
    Quote Originally Posted by tabstop View Post
    So then presumably you only want to do whatever it is you're doing if there's enough mana, so you would need to check first. Then deduct from mana.
    I see
    Thanks For Your Advice

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21