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 


*Proud*

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

Joined: 20 Aug 2007
Posts: 558

PostPosted: Tue Jan 22, 2008 6:05 pm    Post subject: *Proud* Reply with quote

I'm so proud of myself Very Happy. I made first workign program in C++ LOL.
I coded the thing all on my own Very Happy the only thing i give credits to is
Cx for cin.get and cin.ignore., other than that i did all by myself Very Happy
*play im a big boy know song* LOL, k so. ill post the .exe with source if anyone wants. (10-15 lines of code but w/e Very Happy)

here ya go!

-... can't post the exe or the source file.... ill just copy paste code....

Code:

#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
    int num1, num2, num3;
    cout << "Enter your first number" << endl;
    cin >> num1;
    cout << "Enter your second number" << endl;
    cin >> num2;
    cout << "Enter your third number" << endl;
    cin >> num3;
    cout << num1 << "+" << num2 << "+" << num3 << "=" << num1+num2+num3 << endl;
    cin.ignore();
    cin.get();
    return 0;
}



*is dissapointed Crying or Very sad *
Back to top
View user's profile Send private message
.Murder.
Grandmaster Cheater
Reputation: 0

Joined: 28 Nov 2007
Posts: 723

PostPosted: Tue Jan 22, 2008 6:11 pm    Post subject: Reply with quote

Cute =P
_________________
Back to top
View user's profile Send private message
MegaForum
Grandmaster Cheater
Reputation: 0

Joined: 20 Aug 2007
Posts: 558

PostPosted: Tue Jan 22, 2008 6:16 pm    Post subject: Reply with quote

im trying to make it so that you can enter 3 numbers and then have it devide by 3 to find the average, but the math is off... do you know if the command for division is "/" ?
Back to top
View user's profile Send private message
onfia
Cheater
Reputation: 0

Joined: 18 Jan 2008
Posts: 45

PostPosted: Tue Jan 22, 2008 6:20 pm    Post subject: Reply with quote

/ or \ but i think they do different types of division i cant remember.[/b]
Back to top
View user's profile Send private message
MegaForum
Grandmaster Cheater
Reputation: 0

Joined: 20 Aug 2007
Posts: 558

PostPosted: Tue Jan 22, 2008 6:24 pm    Post subject: Reply with quote

this is my modified code from what i added in the start of the thread

Code:

#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
    int num1, num2, num3, num4;
    num4 = 3;
    cout << "Enter your first number" << endl;
    cin >> num1;
    cout << "Enter your second number" << endl;
    cin >> num2;
    cout << "Enter your third number" << endl;
    cin >> num3;
    cout << "The average of your numbers" << "=" << num1+num2+num3/num4 << endl;
    cin.ignore();
    cin.get();
    return 0;
}


i use / and the math ends up all wrong...

example: i enter 5,5,5 for my number which = 15 and then it should divide (/) by num4= 3 and 15/3 = 5. it gets 11 ...
Back to top
View user's profile Send private message
killersamurai
Expert Cheater
Reputation: 0

Joined: 10 Sep 2007
Posts: 197
Location: Colorado

PostPosted: Tue Jan 22, 2008 6:27 pm    Post subject: Reply with quote

/ = divide
% = modulus (remainder)

Order of operations

(a+b+c) / d

It will add first then divide


Last edited by killersamurai on Tue Jan 22, 2008 6:28 pm; edited 1 time in total
Back to top
View user's profile Send private message
onfia
Cheater
Reputation: 0

Joined: 18 Jan 2008
Posts: 45

PostPosted: Tue Jan 22, 2008 6:27 pm    Post subject: Reply with quote

Try using Parenthesis on the math. Remember the Order of Operations. Adding comes last, so division and multiply come first.

Whatever is in the parenthesis in math, the compiler does first, stores it somewhere, and uses it to add whatever number you requested.
Back to top
View user's profile Send private message
MegaForum
Grandmaster Cheater
Reputation: 0

Joined: 20 Aug 2007
Posts: 558

PostPosted: Tue Jan 22, 2008 6:29 pm    Post subject: Reply with quote

Code:

num1+num2+num3/num4


will this know to add numbs 1-3 then divide by num4, or do i have to put like a pause, then tell to divide.
Back to top
View user's profile Send private message
wunder312355
Grandmaster Cheater
Reputation: -1

Joined: 14 May 2007
Posts: 568

PostPosted: Tue Jan 22, 2008 6:30 pm    Post subject: Reply with quote

(num1+num2+num3) / num4

so basicly
First perform any calculations inside parentheses.
Next perform all multiplications and divisions, working from left to right.
Lastly, perform all additions and subtractions, working from left to right.
Back to top
View user's profile Send private message
MegaForum
Grandmaster Cheater
Reputation: 0

Joined: 20 Aug 2007
Posts: 558

PostPosted: Tue Jan 22, 2008 6:34 pm    Post subject: Reply with quote

thefun25 wrote:
(num1+num2+num3) / num4

so basicly
First perform any calculations inside parentheses.
Next perform all multiplications and divisions, working from left to right.
Lastly, perform all additions and subtractions, working from left to right.

thanks xD it was probably think 1/4 of the num3.

IT WORKED! Very Happy


Last edited by MegaForum on Wed Jan 23, 2008 1:36 pm; edited 1 time in total
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Tue Jan 22, 2008 9:43 pm    Post subject: Reply with quote

Jacob, maybe next time, you should blur out your name.
_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
MegaForum
Grandmaster Cheater
Reputation: 0

Joined: 20 Aug 2007
Posts: 558

PostPosted: Wed Jan 23, 2008 1:36 pm    Post subject: Reply with quote

samuri25404 wrote:
Jacob, maybe next time, you should blur out your name.

>.<
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