fork download
  1. #include <vector>
  2. #include <cstdlib>
  3. #include <ctime>
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. srand(time(NULL));
  10.  
  11. vector<char> vec;
  12.  
  13. for (int i = 0; i < 20; i++)
  14. {
  15. vec.push_back((rand() % 26 + 'a'));
  16. }
  17.  
  18. // Print Contents & print out the int vector.
  19. for (int i = 0; i < vec.size(); i++)
  20. {
  21. cout << vec[i] << "\t" << int(vec[i]) << "\n";
  22. }
  23. return 0;
  24. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
q	113
p	112
e	101
b	98
y	121
v	118
w	119
o	111
e	101
n	110
g	103
o	111
h	104
z	122
h	104
y	121
o	111
k	107
t	116
y	121