944,068 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 3339
  • C++ RSS
Aug 1st, 2006
0

c++ vectors using push_back

Expand Post »
hi all,

I'm new to site {nice work on the forum } and to c++ in general. I've started a class in the subject not to long ago and have hit a snag on one of the programing projects i was asigned to do ... I just cant figure this out ...

basicly i'm buildin a code that'll allow me to take some numbers that a user will enter and spit out the smallest, largest and average of the group. this has to be done using the push_back function that'll insert into vector objects.
Now i've figured out how to calculate average, and how to write the codin for the user to enter the numbers, I just haven't got a clue how i can make the code display the smallest and largest numbers of what the user enters ... i mean how can i make c++ determin which of em is smallest and which is largest ???.
the numbers can be anythin from negative to positve ...

if someone can help me out or point me in a direction of some info for this it be much appreciated ...
Similar Threads
Reputation Points: 13
Solved Threads: 0
Newbie Poster
blazinking is offline Offline
3 posts
since Aug 2006
Aug 1st, 2006
1

Re: c++ vectors using push_back

Reputation Points: 197
Solved Threads: 12
Junior Poster
Grunt is offline Offline
147 posts
since Jul 2006
Aug 1st, 2006
0

Re: c++ vectors using push_back

thx a bunch that helps
Reputation Points: 13
Solved Threads: 0
Newbie Poster
blazinking is offline Offline
3 posts
since Aug 2006
Aug 2nd, 2006
1

Re: c++ vectors using push_back

Quote ...
Now i've figured out how to calculate average, and how to write the codin for the user to enter the numbers, I just haven't got a clue how i can make the code display the smallest and largest numbers of what the user enters
I'd bet your prof will want to write your own function to do that.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Aug 2nd, 2006
1

Re: c++ vectors using push_back

Quote originally posted by iamthwee ...
I'd bet your prof will want to write your own function to do that.
well yes ofcourse ... and i'm planin on doin that but i just needed a point in the right direction as to how ... been that i never seen it done i needed a refrence to build my own ...
I wouldnt just copy somones work cause thats not me ...
thats one of the reasons y i didnt post up the code cause i didnt need someone to solve this for me i just needed a boost in where to look into ...

anyways thx for the info help it def. was alot more then i expected :mrgreen: ...
Last edited by blazinking; Aug 2nd, 2006 at 10:08 am.
Reputation Points: 13
Solved Threads: 0
Newbie Poster
blazinking is offline Offline
3 posts
since Aug 2006
Aug 2nd, 2006
0

Re: c++ vectors using push_back

Quote originally posted by blazinking ...
I wouldnt just copy somones work cause thats not me ...
thats one of the reasons y i didnt post up the code cause i didnt need someone to solve this for me i just needed a boost in where to look into ...

anyways thx for the info help it def. was alot more then i expected :mrgreen: ...
You've got the correct attitude. :cheesy:
Moderator
Reputation Points: 572
Solved Threads: 115
Mentally Challenged Mod.
WolfPack is offline Offline
1,559 posts
since Jun 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: who can help me in c++ project
Next Thread in C++ Forum Timeline: help with sorting program





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC