Sato Murasme

Sato Murasme

  • NA
  • 3
  • 583

Print array values correctly

Dec 9 2018 5:24 AM
I made a program that calculates the total number of reproductions per song in every country. Position of songs and countries are stored in a two-dimensional array of doubles. Names of songs and countries are stored in two one dimensional arrays of strings. Example:
 
            |Country 1 | Country 2 | Country 3 |
Song 1 |   3.5        |     4.2        |      2.7      |
Song 2 | 1.3          |       3.2      |        3       |
Song 3 | 4.4          | 1.2            |    0.9        |
                         
Song1: "Song1"|
Song2: "Song2"|
Song3: "Song3"|
 
                                   
Country1: "Country1"|
Country2: "Country2"|
Country3: "Country3"| 
 
I want to PRINT THE TOTAL NUMBER OF REPRODUCTIONS (sum of reproductions of songs) PER COUNTRY.
This is what I want:
 
"Country1":  10.4
"Country2": 8.5
"Country3": 6.5
 
And this is what I get:
 
"Country1": 10.4
"Country2": 10.4
"Country3": 10.4
 
As you can see, it only show the first result.
I made two procedures to do all of this: one to calculate the sum, and the other to print the results. What should I do?
 
 
 

Answers (1)