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 


Averager - My first c++

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

Joined: 01 Aug 2007
Posts: 1257

PostPosted: Wed Jan 23, 2008 8:13 pm    Post subject: Averager - My first c++ Reply with quote

Code:
#include<iostream>
using namespace std;

int main (void)
{
   
    double dnumber1 = 0.0;
    double dnumber2 = 0.0;
    double dnumber3 = 0.0;
    double daverage = 0.0;
   
    cout << "please enter 3 numbers: " << endl;
    cin >> dnumber1;
    cin >> dnumber2;
    cin >> dnumber3;
   
    daverage = (dnumber1 + dnumber2 + dnumber3) / 3;
   
    cout << "the average of the numbers are: " << daverage << endl << endl;
   
    system("pause");
    return 0;
   
}     



you type 3 numbers in, and it averages them. Kinda neat, huh?

_________________
Back to top
View user's profile Send private message
wunder312355
Grandmaster Cheater
Reputation: -1

Joined: 14 May 2007
Posts: 568

PostPosted: Wed Jan 23, 2008 8:26 pm    Post subject: Reply with quote

endl twice?

Anyways, move forward to functions and stuff now.
otherwise GJ
Back to top
View user's profile Send private message
spectrum
Expert Cheater
Reputation: 0

Joined: 27 Mar 2007
Posts: 143

PostPosted: Wed Jan 23, 2008 9:55 pm    Post subject: Reply with quote

GJ, keep it up!
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Wed Jan 23, 2008 10:30 pm    Post subject: Reply with quote

New challenge:

Make it so i can enter as many numbers as i want, not just 3

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Jan 23, 2008 11:44 pm    Post subject: Reply with quote

blankrider wrote:
New challenge:

Make it so i can enter as many numbers as i want, not just 3


argh you stole my suggestion.
Back to top
View user's profile Send private message
Aikos
Cheater
Reputation: 0

Joined: 26 Nov 2007
Posts: 47

PostPosted: Thu Jan 24, 2008 4:16 am    Post subject: Reply with quote

blankrider wrote:
New challenge:

Make it so i can enter as many numbers as i want, not just 3


Any specification on how to stop the input?
Back to top
View user's profile Send private message
Losplagos
Expert Cheater
Reputation: 0

Joined: 21 Mar 2006
Posts: 172
Location: Knee deep in a c++ book

PostPosted: Thu Jan 24, 2008 6:26 am    Post subject: Reply with quote

Aikos wrote:
blankrider wrote:
New challenge:

Make it so i can enter as many numbers as i want, not just 3


Any specification on how to stop the input?


Let me think a little.

_________________

Earthbound = 31337
Back to top
View user's profile Send private message
AndrewMan
Grandmaster Cheater Supreme
Reputation: 0

Joined: 01 Aug 2007
Posts: 1257

PostPosted: Thu Jan 24, 2008 11:50 am    Post subject: Reply with quote

Im trying but I can't figure it out.

Can you make dnumber infinate or something?

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Jan 24, 2008 12:58 pm    Post subject: Reply with quote

Hint: loop until the user says otherwise
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Thu Jan 24, 2008 1:12 pm    Post subject: Reply with quote

AndrewMan wrote:
Can you make dnumber infinate or something?


yes. look up std::vector
Back to top
View user's profile Send private message
mer0x
Advanced Cheater
Reputation: 0

Joined: 06 Jan 2008
Posts: 63

PostPosted: Thu Jan 24, 2008 5:55 pm    Post subject: Reply with quote

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