Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <time.h>
- #include <stdlib.h>
- char* gen_word();
- ///////////////////////////////////////////////////////////////
- int main() //
- {
- srand( time(0));
- for(int i = 0; i < 10; i++)
- {
- printf("%s\n", gen_word() );
- }
- }
- ///////////////////////////////////////////////////////////////
- char gen_symb() //
- {
- char c = 97 + rand()%26;
- return c;
- }
- ///////////////////////////////////////////////////////////////
- char* gen_word() //
- {
- int n = 1 + rand() % 11;
- printf("%2d = ", n);
- static char sz[99];
- for(int i = 0; i <= n; i++)
- {
- if(i == n) sz[i] = 0;
- else sz[i] = gen_symb();
- }
- return sz;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement