Advertisement
helos3

rand char

Oct 4th, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. #include <tchar.h>
  6.  
  7. int _tmain(int argc, _TCHAR* argv[])
  8. {
  9. int i=20;
  10. char s[20];
  11.  
  12. srand((unsigned int)time(NULL));
  13.  
  14. char a='A';
  15. for (i =1; i <= 20; i++) {
  16. s[i]=rand() % 22 +(int)(a);
  17. s[i]=(char)s[i];
  18. printf("%c\n", s[i]);
  19. }
  20. system("pause");
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement