Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <stdlib.h>
- #include <time.h>
- #define max 50
- #define pokusaji 6
- void stampajRec(int i, char strCrtice[60])
- {
- int j;
- for(j=0; j<i; j++)
- {
- printf("%c",strCrtice[j]);
- printf(" ");
- }
- }
- int main()
- {
- FILE *fp;
- char str[60];
- int br = 0;
- char* jebem;
- int i=0;
- char strCrtice[60];
- srand(time(NULL)); //generise rand sa time iz pc-a
- fp = fopen("reci.txt" , "r");
- while(fgets (str, 60, fp)!=NULL )
- {
- br++;
- }
- fclose(fp);
- fp = fopen("reci.txt" , "r");
- int line= rand()%br+1; //755555%5+1
- while(line)
- {
- jebem = fgets(str, 60, fp);
- line--;
- }
- i = strlen(jebem) -1;
- int j=0;
- for(j=0; j<i; j++)
- {
- strCrtice[j] = '_';
- }
- strCrtice[j+1] = '\0';
- //printf("%d", i);
- printf("%s", jebem);
- //stampajRec(i, strCrtice);
- stampajRec(i, strCrtice);
- char temp;
- printf("\n");
- for(;;)
- {
- scanf("%c", &temp);
- printf("\n");
- for(j=0; j<i; j++)
- if(jebem[j]==temp)
- strCrtice[j]=temp;
- if(!isspace(temp))
- {
- stampajRec(i, strCrtice);
- }
- printf("\n");
- }
- fclose(fp);
- return 0;
- }
- /*
- if( fgets (str, 60, fp)!=NULL )
- {
- puts(str);
- }
- fclose(fp);
- return(0);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement