I tried reading other questions to find the answer to my question but I got tired of seeing the answer being in a different coding language. I want to change the amount of numbers in my random error code. I am genuinely new to this so please no rude comments.
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main () {
int i,j[3];
srand( (unsigned)time( NULL ) );
I set the array for j to 3 so I could try and get a maximum of 3 numbers.
for( i = 0; i < 1; i++ ) {
j[3] = rand();
cout <<"Error code: " << j << endl;
}
return 0;
}
Here is where the error comes in, the output of the code only sends the variable address instead of the random number. I really need help with this before I could continue my project. Please help.
Edit: Variable address is "0x7ffc9b46ed5c"
Aucun commentaire:
Enregistrer un commentaire