Answers for "C++ generate a random letter"

C++
0

C++ generate a random letter

#include <iostream>

int main() {
    srand(time(0));
    std::cout <<"random uppercase = " << char('A' + rand() % 26) << std::endl;
    // or
    std::cout <<"random uppercase = " << char('a' + rand() % 26) << std::endl;
}
Posted by: Guest on May-03-2021

Code answers related to "C++ generate a random letter"

Browse Popular Code Answers by Language