Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <time.h>
- #include <string.h>
- #include <stdlib.h>
- int makefile(){
- return system("echo %time% > time.txt");
- }
- void clearchar(char *cha,int len){
- int i;
- for(i=0;i<len;i++){
- if(!('0'<=*(cha+i)&&*(cha+i)<='9'))
- *(cha+i) = '0';
- }
- }
- int gettime(){
- if(!(makefile())){
- FILE *fp;
- char time[255];
- fp = fopen("time.txt", "r");
- fscanf(fp, "%s", time);
- fclose(fp);
- clearchar(time,strlen(time));
- return atoi(time);
- }else{
- return 0;
- }
- }
- int main(){
- while(1){
- srand(gettime());
- int r = rand() % 101;
- printf("%d\n",r);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement