0
How do you randomly print words to console???
6 Réponses
+ 8
make a list/array of words
use rand() to select a number between 0 and the number of words - 1
print the word
+ 8
Probably something like this crap, idk. :D
https://code.sololearn.com/cSY5Ob4m8isM/?ref=app
+ 6
@Esenyi: you probs already know that time.h is a c header., ctime is the c++ header
Not that it makes all that much difference though 😊
+ 4
#include <iostream>
#include <cstdlib>
#include <time.h>
using namespace std;
int main() {
char word[10];
for (int i = 0; i < 10; i++ )
{
for (int j = 0; j < 10; j++)
{
//assign word[j] with random number generator with a modulus of 26 and 65 added to its value
}
cout << word << endl;
}
return 0;
}
+ 3
@Jay thanks for that didn't remember