Welcome to Dream.In.Code
Become a Java Expert!

Join 149,534 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,524 people online right now. Registration is fast and FREE... Join Now!




Vector-Urgent

 
Reply to this topicStart new topic

Vector-Urgent, Adding the values

karakartal06
23 May, 2007 - 01:45 AM
Post #1

New D.I.C Head
*

Joined: 23 May, 2007
Posts: 1


My Contributions
Hi
I need help in vectors. When I run my program on the terminal i get
Crop (kg)
yr1-150
yr2-200
yr3-450
yr4-220
yr5-554
but it shows ten of the weights using a vector. So im using a vector to print out a 10 years of crop weight.

But my problem is how would i be able add all the values in that vector (the weights).
Thanks
User is offlineProfile CardPM
+Quote Post

Ellie
RE: Vector-Urgent
23 May, 2007 - 03:58 AM
Post #2

D.I.C Regular
Group Icon

Joined: 17 Jan, 2007
Posts: 427



Thanked: 4 times
Dream Kudos: 150
My Contributions

You could use a loop to iterate through the Vector and add all the values together.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 09:03PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month