0

How do you get random numbers into an array in C?

How do you fill a string with 10 numbers but having those numbers come out in random (numbers between say 1-10)

29th Apr 2019, 12:07 PM
Fadal Arhab Farouk
1 Antwort
0
#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main () { srand(time(0)); for (int x = 1; x <=1 //numbers on colomn ; x++) { cout << 1 + (rand() % 10) << endl; } }
4th May 2019, 5:57 PM
Разумов Андрей Михайлович