| | | Programming Discuss all your programming needs here. |  | 
11-20-2009
|  | Contributor | | | Join Date: Mar 2008 Location: void Home()
Posts: 964
Nominated 1 Times in 1 Post Reputation: 265 Level up: 55%, 498 Points needed |     | | | [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;
__________________ i saw wut u did thar. | Donate to remove ads, get your "DONATOR title, and get access to the MMOwned community's elite Shoutbawx. 
11-20-2009
|  | Legendary Legendary User  | | | Join Date: Nov 2006 Location: Germany (DE)
Posts: 2,531
Nominated 17 Times in 4 Posts Reputation: 679 Points: 19,334, Level: 19 | Level up: 3%, 1,466 Points needed |     | | | #include <math>
double sqrt(double);
float sqrtf(float);
// ...
float result = sqrtf( num * num2 );
cout << "The square root of " << num << " * " << num2 << " is " << result << "." << endl; | 
11-20-2009
|  | Contributor | | | Join Date: Mar 2008 Location: void Home()
Posts: 964
Nominated 1 Times in 1 Post Reputation: 265 Level up: 55%, 498 Points needed |     | |
__________________ i saw wut u did thar. | 
11-20-2009
|  | Legendary Legendary User  | | | Join Date: Nov 2006 Location: Germany (DE)
Posts: 2,531
Nominated 17 Times in 4 Posts Reputation: 679 Points: 19,334, Level: 19 | Level up: 3%, 1,466 Points needed |     | | | math.h ._.
Do me a favor and dont use that ****ing bad style. Also: '1' is not 1. | 
11-20-2009
| | Contributor | | | Join Date: Sep 2006 Location: Jaedenar O.o
Posts: 645
Reputation: 171 Level up: 93%, 63 Points needed |     | | Quote:
Originally Posted by schlumpf Also: '1' is not 1. | He's checking for the entered key. | 
11-20-2009
|  | Contributor | | | Join Date: Mar 2008 Location: void Home()
Posts: 964
Nominated 1 Times in 1 Post Reputation: 265 Level up: 55%, 498 Points needed |     | | | 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
__________________ i saw wut u did thar.
Last edited by -Jebus Fist-; 11-20-2009 at 01:48 PM.
| 
11-20-2009
|  | Legendary Legendary User  | | | Join Date: Nov 2006 Location: Germany (DE)
Posts: 2,531
Nominated 17 Times in 4 Posts Reputation: 679 Points: 19,334, Level: 19 | Level up: 3%, 1,466 Points needed |     | | Quote:
Originally Posted by MaiN 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. | 
11-21-2009
|  | Kynox's sister's pimp Legendary User | | | Join Date: Apr 2006 Location: ntdll.dll
Posts: 4,575
Nominated 63 Times in 4 Posts  TOTM/W Award(s): 1 Reputation: 1120 Points: 64,104, Level: 37 | Level up: 45%, 2,096 Points needed |     | | Quote:
Originally Posted by schlumpf math.h ._.
Do me a favor and dont use that ****ing bad style. Also: '1' is not 1. | Not "math.h". "cmath". | 
11-21-2009
|  | Legendary Legendary User  | | | Join Date: Nov 2006 Location: Germany (DE)
Posts: 2,531
Nominated 17 Times in 4 Posts Reputation: 679 Points: 19,334, Level: 19 | Level up: 3%, 1,466 Points needed |     | | Quote:
Originally Posted by Cypher 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. ._. | 
11-21-2009
|  | Contributor | | | Join Date: Mar 2008 Location: void Home()
Posts: 964
Nominated 1 Times in 1 Post Reputation: 265 Level up: 55%, 498 Points needed |     | | Quote:
Originally Posted by Cypher Not "math.h". "cmath". | If i just make a file named math.h and write:
#include "math.h"
in main.cpp
then it works. 
__________________ i saw wut u did thar. | 
11-22-2009
|  | Kynox's sister's pimp Legendary User | | | Join Date: Apr 2006 Location: ntdll.dll
Posts: 4,575
Nominated 63 Times in 4 Posts  TOTM/W Award(s): 1 Reputation: 1120 Points: 64,104, Level: 37 | Level up: 45%, 2,096 Points needed |     | | Quote:
Originally Posted by schlumpf 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. Quote:
Originally Posted by -Jebus Fist-
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. | 
11-22-2009
|  | Contributor | | | Join Date: Mar 2008 Location: void Home()
Posts: 964
Nominated 1 Times in 1 Post Reputation: 265 Level up: 55%, 498 Points needed |     | | Quote:
Originally Posted by Cypher ....
Words cannot describe your retardation. | Well, since im a noob then i believe that words can describe it.
__________________ i saw wut u did thar. | 
11-22-2009
| | New User | | | Join Date: Jan 2009
Posts: 52
Reputation: 2 Level up: 29%, 356 Points needed |  | | | lol this topic is going from Calculator help to Retardation roflmao |  |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -4. The time now is 03:39 AM. |