mardi 22 mai 2018

how to get random number between 5 and -5 in c++

i am trying to get random numbers using rand % (5 -5) and it gives division by zero error

#include <iostream>
using namespace std;
int main()
{
int A[20];
for (int i-0 ;i<20;i++)
 A[i]= rand() % -5;

system("pause")
return 0;
}




Aucun commentaire:

Enregistrer un commentaire