Thread: rune tipe error - calculator

  1. #1
    beginner for now
    Join Date
    Oct 2009
    Posts
    35

    rune tipe error - calculator

    hi everybody I got an rune tip error -- >> it's marked in program
    what should I do that program will give me one more time to correct if I want
    manual or blind or exit calc

    Code:
    #include <iostream>
    #include <string>
    using namespace std;
    
    void options (int * ptrchoose_calc);
    void calc_manual ();
    void calc_blind  ();
    
    
    int main ()
    {
        
        int choose_calc;
        int * ptrchoose_calc = &choose_calc;
        
        bool menu = true;
        do
        {
            cout << "\n                               CALCULATOR\n\n";
            
            cout << "choose\n'manual' calculator or\n'blind' calculator or\n'exit' calculator";
            options  (ptrchoose_calc);
            if       (choose_calc == 1) calc_manual();
            else if  (choose_calc == 2) calc_blind ();
            else if  (choose_calc == 3) menu = false;
    ///*error 999*/
            else {cout << "error 999";system ("pause");return 0;} // it shouldn't happen but as an safety procedure (emargency shut down)
    /*error 999*///
        }
        while (menu == true);
        cout << "enter something to exit" << endl;
        int quit;
        cin >> quit;
        return 0;
    }
    
    
    
    
    
    
    
    
    
    
    ////////////////////////////////////////////////////////////
    void options (int * ptrchoose_calc)                       //
    {                                                         //
         string y;                                            //
         string manual = "manual" ;                           //
         string blind  = "blind"  ;                           //
         string exit   = "exit"   ;                           //
                                                              //>>>>> UNKNOWN RUNE TIPE ERROR <<<<<  //
         getline (cin , y);                                   //             DESCRIPTION             //
                                                              //when it's on end of loop and comes   //I'm out of idea how to repair this
         if      (y == manual) * ptrchoose_calc = 1;          //back here it don't wont to ask for   //
         else if (y == blind)  * ptrchoose_calc = 2;          //        me to tipe in y again        //
         else if (y == exit)   * ptrchoose_calc = 3;          //
         else {cout << "please tipe in 'manual' or 'blind'";} //
    }///////////////////////////////////////////////////////////
    
    void calc_manual ()
    {
         float number1    = 0  ;
         float number2    = 0  ;
         char operator1 = 0  ;
         
         cout << "\n\n\nenter a number:";
         cin >> number1;
         cin.clear();
         
         do
         {
             cout << "\nenter a operator + or - or / or * :";
             cin >> operator1;
         }
         while (operator1 != '+' && operator1 != '-' && operator1 != '/' && operator1 != '*');
         
         cout << "\nenter secon'd number:" ;
         cin >> number2;
         cin.clear();
         
         if      (operator1 == '+') cout << number1 << " + " << number2 << " = " << number1 + number2 << endl ;
         else if (operator1 == '-') cout << number1 << " - " << number2 << " = " << number1 - number2 << endl ;
         else if (operator1 == '/') cout << number1 << " / " << number2 << " = " << number1 / number2 << endl ;
         else if (operator1 == '*') cout << number1 << " * " << number2 << " = " << number1 * number2 << endl ;
    ///*error119*/
         else {cout << "error 119"; system ("pause");} // it shouldn't come to this
    /*error119*///
    }
    void calc_blind  ()
    {
         float number1    = 0  ;
         float number2    = 0  ;
         char operator1 = 0  ;
         
         cin >> number1;
         cin.clear();
         
         do
         {
             cin >> operator1;
             if (operator1 != '+' && operator1 != '-' && operator1 != '/' && operator1 != '*') cout << "please enter + or - or / or *" << endl;
         }
         while (operator1 != '+' && operator1 != '-' && operator1 != '/' && operator1 != '*');
         
         cin >> number2;
         cin.clear();
         
         if      (operator1 == '+') cout << number1 << " + " << number2 << " = " << number1 + number2 << endl ;
         else if (operator1 == '-') cout << number1 << " - " << number2 << " = " << number1 - number2 << endl ;
         else if (operator1 == '/') cout << number1 << " / " << number2 << " = " << number1 / number2 << endl ;
         else if (operator1 == '*') cout << number1 << " * " << number2 << " = " << number1 * number2 << endl ;
    ///*error229*/
         else {cout << "error 229"; system ("pause");} // it shouldn't come to this
    /*error229*///
    }

  2. #2
    beginner for now
    Join Date
    Oct 2009
    Posts
    35
    problem solved
    Code:
    cin.ignore();
    after
    Code:
    cin >> x

Popular pages Recent additions subscribe to a feed