Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 5. Array Data Structures > 5.8 FURTHER USES FOR THE APPLICATION

5.8 FURTHER USES FOR THE APPLICATION

All that the program described in Section 5.6 currently does is store and output the data. How else might it be used? Well, we could compare the performance of different regions across the year, using the total sales of each. This is equivalent to adding all four values across each row of the table in turn. To do this, declare a variable, total, and set it to zero. Then add all figures of the four quarters for a region to total.

total = 0;
for (quarter = 0; quarter < 4; quarter++)
    total = total + sales[region][quarter];


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint