the program generates a random number when its suposed to be a random letter
The program compiles and executes fine but it generates a random number between 1-20 when i want it to generate a letter between c,d,h,and s.
thanx
Code:
#include <iostream>
#include <stdlib.h>
#include <ctime>
#include <cstdlib>
#include <string>
using namespace std;
int main()
{
char randsuit;
const char suit[] = "cdhs";
srand(time(NULL));
randsuit = suit[rand() % (sizeof(suit)-1)];
cout << randsuit << endl;
system("PAUSE");
return 0;
}