N
news-acct
Hi - looking for pointers or links to resources ...
I am reading in a text file - lines are
prod_id cost sn
Prod1 1000 123
Product1 1000 124
Product1 2000 456
Prod1 2000 457
Product2 1000 323
Prod2 1000 324
Product2 2000 556
Prod2 2000 557
Product3 1000 223
Prod3 1000 224
Product3 2000 756
I need to count how many of each product, and how many of each product AND
cost.
Count of Product1 - 1000: 2
Count of Product1 - 2000: 2
Total count of Product1: 4
Count of Product2 - 1000: 2
Count of Product2 - 2000: 2
Total count of Product2: 4
Count of Produc3 - 1000: 2
Count of Product3 - 2000: 1
Total count of Product3: 3
Total count of all products: 11
It seems to be that an array would work great here, but I am not successful
at doing it.
would like to have an array -
array_cnt[Product_id][cost_value][count]
where I could just increment the [count] value.
Thanks.
I am reading in a text file - lines are
prod_id cost sn
Prod1 1000 123
Product1 1000 124
Product1 2000 456
Prod1 2000 457
Product2 1000 323
Prod2 1000 324
Product2 2000 556
Prod2 2000 557
Product3 1000 223
Prod3 1000 224
Product3 2000 756
I need to count how many of each product, and how many of each product AND
cost.
Count of Product1 - 1000: 2
Count of Product1 - 2000: 2
Total count of Product1: 4
Count of Product2 - 1000: 2
Count of Product2 - 2000: 2
Total count of Product2: 4
Count of Produc3 - 1000: 2
Count of Product3 - 2000: 1
Total count of Product3: 3
Total count of all products: 11
It seems to be that an array would work great here, but I am not successful
at doing it.
would like to have an array -
array_cnt[Product_id][cost_value][count]
where I could just increment the [count] value.
Thanks.