mardi 13 mars 2018

Creating a 2d array with random numbers

good evening. I am hoping to get some help. I go to University of Phoenix and we were assigned a project. This is possibly the worst class I have ever had. They explain nothing relevant to the assignments. I have spent a week trying to figure this out and maybe I am just searching this wrong. I cannot figure out how to link the array[5][5] to the random function(they must be random numbers). I cannot figure out how to populate the array in such a way that I can calculate average and totals of each row. It must be formatted like this for each row Row 1 Total = Average = The code I have so far, which is probably really wrong, is this:

#include "stdafx.h"
#include<iostream>
#include<ctime>

using namespace std;

int main()
{
srand(time(NULL));
int rantab[5][5] = { rand() % 89 + 10 };
int i, m;

for(int i = 0; i < 5; i++);
{
    for (int m = 0; m < 5; m++);
}
cout << rantab[i][m];
return 0;
}

Any help I can get is appreciated. I have no idea where to go from here, if I am even correct so far. I love the c++ I got to learn in C++ without fear but this class just sucks all the fun and life out of it. Thank you again.




Aucun commentaire:

Enregistrer un commentaire