Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C++ question

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
AwayTheWInd
Master Cheater
Reputation: 0

Joined: 11 Sep 2007
Posts: 450

PostPosted: Wed Apr 02, 2008 4:43 pm    Post subject: C++ question Reply with quote

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
View user's profile Send private message
HalfPrime
Grandmaster Cheater
Reputation: 0

Joined: 12 Mar 2008
Posts: 532
Location: Right there...On your monitor

PostPosted: Wed Apr 02, 2008 5:01 pm    Post subject: Reply with quote

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 Laughing %d", avar, astring);
http://www.cplusplus.com/reference/clibrary/cmath/
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Wed Apr 02, 2008 5:02 pm    Post subject: Reply with quote

.... 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
View user's profile Send private message
AwayTheWInd
Master Cheater
Reputation: 0

Joined: 11 Sep 2007
Posts: 450

PostPosted: Wed Apr 02, 2008 5:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites