| View previous topic :: View next topic |
| Author |
Message |
AwayTheWInd Master Cheater
Reputation: 0
Joined: 11 Sep 2007 Posts: 450
|
Posted: Wed Apr 02, 2008 4:43 pm Post subject: C++ question |
|
|
how to square root or sine? i tried this:
a1 = double sin/sqrt(double_a1);
error: unexpected double
i also tried many more but i cant get it working.
also, how can i use the printf/sprintf function? i tried it like this:
char a3 [256]
printf(a3,"a3 = %d")
error: printf indentifier not recognized.
i tried sprintf too. someone help T_T
_________________
|
|
| Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Wed Apr 02, 2008 5:01 pm Post subject: |
|
|
| Code: | #include <iostream.h>
#include <math.h>
using snamepsace std;
int main(){
double avar;
avar = sin(9000);
String astring;
astring = "lolcocks";
cout << avar << " :lol: " << astring << endl;
system("PAUSE");
return 0;
} |
You're using C++, just use cout instead of printf
but it would be (I think)
printf("%s %d", avar, astring);
http://www.cplusplus.com/reference/clibrary/cmath/
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Wed Apr 02, 2008 5:02 pm Post subject: |
|
|
.... do u even know, or even looked how printf/sin/sqrt is executed...
1. printf requires stdio.h
2. printf's syntax is text first, then variables defined in the print
| Code: | | printf("a3 = %d", a3); |
3. sin and sqrt require math.h
4. a1 = double sin/sqrt?
double valtosqrt = 1000.00;
double valtosin = 50.0;
double a1 = sqrt(valtosqrt);
double a2 = sin(valtosin*3.14159265/180);
Edit: @ guy above me. Doesn't matter if hes using C++, he can use printf if he wants, i like printf better then cout myself.
_________________
|
|
| Back to top |
|
 |
AwayTheWInd Master Cheater
Reputation: 0
Joined: 11 Sep 2007 Posts: 450
|
Posted: Wed Apr 02, 2008 5:06 pm Post subject: |
|
|
yes i had the math.h and stdio.h.
lol so i got the syntax wrong. still it wont let me do that for sqrt.
ty though.
EDIT: LOL I PUT THE #include xxxxx
crap in the wrong spot XD
btw i was using this formula for an aimbot xD woot first useful program made.
_________________
|
|
| Back to top |
|
 |
|