Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- FILE* fp=fopen("numere.txt","r");
- FILE* f=fopen("numere_out.txt","w");
- if(!fp)
- return -1;
- int n, key;
- fscanf(fp,"%d",&n);
- fscanf(fp,"%d",&key);
- for(int i=0;i<n;i++)
- {
- int x;
- fscanf(fp,"%d",&x);
- fprintf(f,"%d ",x^key);
- }
- fclose(fp);
- fclose(f);
- fp=fopen("numere_out.txt","r");
- FILE* g=fopen("numere_out2.txt","w");
- for(int i=0;i<n;i++)
- {
- int x;
- fscanf(fp,"%d",&x);
- fprintf(f,"%d ",x^key);
- }
- fclose(fp);
- fclose(g);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment