Trying to create a random number generator using Arrays, but the " a[i] = rand();" portion of my code creates an error of the type "Identifier i is Undefined". Can anyone find where I am going wrong here? Thanks
#include <iostream>
#include <string>
#include <array>
using namespace std;
int main()
{
int a[10] = {};
for (int i = 0; i < size(a); i++); {
a[i] = rand();
}
for (int i = 0; i < size(a); i++) {
cout << "The random number is: " << a[i] << endl;
}
}
Aucun commentaire:
Enregistrer un commentaire