mardi 25 octobre 2016

how to add together arrays in c++ and output the sum

We're going to experiment with a simple problem: finding the sum of a two-dimensional array of floats. The provided code declares an array with dimensions HEIGHT and WIDTH (height/Y comes first, width/X comes second), and fills it with values when the program starts. ► Replace the sleep_for call with code to add up the numbers in the array. Use a float variable to hold the sum, and two nested for loops to go through all the X and Y positions in the array. Make the outer loop the X coordinate, and the inner loop the Y coordinate. ► After the end time has been recorded, print the sum to cout.

this is the task

Aucun commentaire:

Enregistrer un commentaire