• Post Reply Bookmark Topic Watch Topic
  • New Topic

Variable value wont print  RSS feed

 
Sam Kluender
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm making a program where the user enters an ID number and can submit the amount of sales that person made for a specific product and write to a file. One of the things I have to do is making a running sum of the sales for each product for all people combined as well as an accumulation of the a persons sales every time he enters data. Everything seems to be working execpt my values like person1Total, person2Total...etx and product2Total.

When I try to write them to the file, they always come out at 0.0 even though they should be the sum of the indexes of the array sales. Any help?

 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sam Kluender wrote: my values like person1Total, person2Total...etx and product2Total.

When I try to write them to the file, they always come out at 0.0 even though they should be the sum of the indexes of the array sales. Any help?

You are using the values in the sales array to set the values of those variables. You do this on lines 18 - 26, but you don't actually put any values into the array until line 33.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!