Answer to Question #39301 in C++ for ahmed

Question #39301
write a c++ program to generate and print out the alphabetic letter
1
Expert's answer
2014-03-04T10:13:21-0500
#include <iostream>
#include <time.h>

using namespace std;

char generateLetter()
{
return 'a' + rand() % 26;
}

int main (void)
{
srand((unsigned int)time(0));

char letter = generateLetter();
cout << "Generated letter: " << letter
<< endl;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS