random - Why I'm getting wrong symbols? C++ -


I need random symbols from the class ASCII

Why are some weird symbols?

#include & lt; Iostream & gt; # Include & lt; Stdio.h & gt; # Include & lt; Time.h> using namespace std; Int main () {char k; Int i; Srand (time (0)); (I = 1; i & lt; -10; i ++) {k = (rand (% 33) + 15; Printf ("% c", k);} return 0;} < OK

OK, you need to understand a bit better: here you

  #include & lt; stdio.h & gt; # Include & lt; stdlib.h & gt; # Include & lt; time.h & gt; # Include & lt; unistd.h & gt; Main () (I = 1; i & lt; = 10; i ++) {k = (rand (%) 14, + 33; // Category (for four k; int i; srand (time (zero)) 47 - 33) To add that category, add 33. Printf ("% c", k);} return 0;}  

will take the mod number, and it 0-1 3 will be placed between the boundaries, then we add 33 to 33 and 47.

Hope it helps you.

The number you did was 0 and Placed between the range of 32, then put 15 in the range of 15 and 47 (SI - '/').


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -