[LF Help] Calculator menu

Shout-Out

User Tag List

Results 1 to 13 of 13
  1. #1
    P1raten's Avatar Banned
    Reputation
    500
    Join Date
    Mar 2008
    Posts
    1,323
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [LF Help] Calculator

    Im looking for a way to calculate something like this in cpp:
    x = √y * z

    heres a part of my script so that you can make the 'fix' compatible.

    Code:
               case '2':
    		cout<<"\n";
                    cout<<"Write the amount of Resistance..\n";
                    cin>>num;
                    cout<<"Write the amount of Current..\n";
                    cin>>num2;
                    cout<<num * num2;
                    cout<<"\n";
    		cout<<"\n";
                    break;

    [LF Help] Calculator
  2. #2
    schlumpf's Avatar Retired Noggit Developer

    Reputation
    755
    Join Date
    Nov 2006
    Posts
    2,759
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    #include <math>

    double sqrt(double);
    float sqrtf(float);

    // ...

    float result = sqrtf( num * num2 );
    cout << "The square root of " << num << " * " << num2 << " is " << result << "." << endl;

  3. #3
    P1raten's Avatar Banned
    Reputation
    500
    Join Date
    Mar 2008
    Posts
    1,323
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I get the error:
    Error 1 fatal error C1083: Cannot open include file: 'math': No such file or directory c:\documents and settings\klr9lijuhli\mina dokument\visual studio 2005\projects\answerer\answerer\main.cpp 3

    #include <math>

    double sqrt(double);
    float sqrtf(float);


    case '1':
    cout<<"\n";
    cout<<"Write the amount of Resistance..\n";
    cin>>num;
    cout<<"Write the amount of Effect..\n";
    cin>>num2;
    cout<<sqrtf(num * num2);
    cout<<"\n";
    cout<<"\n";
    break;

    Here's the full script:
    C++ pastebin - collaborative debugging tool

  4. #4
    schlumpf's Avatar Retired Noggit Developer

    Reputation
    755
    Join Date
    Nov 2006
    Posts
    2,759
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    math.h ._.

    Do me a favor and dont use that ****ing bad style. Also: '1' is not 1.

  5. #5
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by schlumpf View Post
    Also: '1' is not 1.
    He's checking for the entered key.
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  6. #6
    P1raten's Avatar Banned
    Reputation
    500
    Join Date
    Mar 2008
    Posts
    1,323
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I still get the error. And i got the math.h in the same directory as the main.cpp

    EDIT: Nvm i fixed it. Thx schlumpf
    Last edited by P1raten; 11-20-2009 at 01:48 PM.

  7. #7
    schlumpf's Avatar Retired Noggit Developer

    Reputation
    755
    Join Date
    Nov 2006
    Posts
    2,759
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by MaiN View Post
    He's checking for the entered key.
    Looking at the last "calculator" topic, people seem to use cin and an integer for such things. I didn't think he would take a char.

    Also, I love the "case '11':" part.

  8. #8
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by schlumpf View Post
    math.h ._.

    Do me a favor and dont use that ****ing bad style. Also: '1' is not 1.
    Not "math.h". "cmath".

  9. #9
    schlumpf's Avatar Retired Noggit Developer

    Reputation
    755
    Join Date
    Nov 2006
    Posts
    2,759
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post
    Not "math.h". "cmath".
    Oh right, we are in ++.. I get confused by my terrible C lecture. God, I wish I wouldn't be forced to attend it. That's what you get for wanting a bachelor's degree. ._.

  10. #10
    P1raten's Avatar Banned
    Reputation
    500
    Join Date
    Mar 2008
    Posts
    1,323
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post
    Not "math.h". "cmath".
    If i just make a file named math.h and write:

    #include "math.h"

    in main.cpp

    then it works.

  11. #11
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by schlumpf View Post
    Oh right, we are in ++.. I get confused by my terrible C lecture. God, I wish I wouldn't be forced to attend it. That's what you get for wanting a bachelor's degree. ._.
    Failure.

    Originally Posted by -Jebus Fist- View Post

    If i just make a file named math.h and write:

    #include "math.h"

    in main.cpp

    then it works.
    ....

    Words cannot describe your retardation.

  12. #12
    P1raten's Avatar Banned
    Reputation
    500
    Join Date
    Mar 2008
    Posts
    1,323
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post
    ....

    Words cannot describe your retardation.
    Well, since im a noob then i believe that words can describe it.

  13. #13
    Asbfaw's Avatar Member
    Reputation
    2
    Join Date
    Jan 2009
    Posts
    51
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol this topic is going from Calculator help to Retardation roflmao

Similar Threads

  1. Replies: 2
    Last Post: 10-31-2010, 10:33 AM
  2. [Guide] Formula to help you calculate your gross income on disenchanting mats
    By Gelormino in forum World of Warcraft Guides
    Replies: 8
    Last Post: 08-22-2010, 12:22 PM
  3. Hit points and talent points? Please help
    By hankusdankus in forum World of Warcraft General
    Replies: 6
    Last Post: 05-04-2006, 02:00 PM
  4. bot help
    By xwhitedeathx in forum World of Warcraft General
    Replies: 3
    Last Post: 05-01-2006, 03:50 AM
All times are GMT -5. The time now is 05:55 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search