+ 4
Random
How to create a code for deducing random letters.
3 ответов
+ 7
const stand for constant, so that letters don't get switch while the program runs.
+ 3
You can only get random integers, so it would look something like this:
#include <iostream>
#include <string>
#include <ctime>
#include <cstdlib> //I think this is header with rand & srand
using namespace std;
const string ch = “qwertyuiopasdfghjklzxcvbnm”;
int main() {
srand(time(0));
int a = rand() % 26;
cout << ch[a];
return 0;
}
0
What does const do? please tell me