Hey, When i say right i mean is this the best way to do it. The program works fine and I just put it together in about one minute.

#include <iostream>

using namespace std;

int main()
{
    srand(time(NULL));
    
    const char* words[] = {"silly", "bafoon", "monkey"};
    int i = rand() % 3;
    
    cout << words[i];
            
    cin.get();
    
    return 0;
}

Recommended Answers

All 2 Replies

Seems to be good :)
Only problem I had was that I had to include <ctime> in order to compile it.

Oh Ok. I didn't need <ctime>. Thanks anyways

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.