Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- // 1c.______________________________________
- float pi = 3.1415926;
- char* s = "kerulete";
- double m = 6.23768e+24;
- printf("%.2f %12s %.3e", pi, s, m);
- printf("\n");
- // 2c.______________________________________
- int u1;
- double v1,v2;
- FILE* input;
- input = fopen("in.txt","r");
- if(input == NULL){
- perror(input);
- }
- fscanf(input,"%d %lf %lf", &u1, &v1, &v2 );
- fclose(input);
- printf("%d %lf %lf\n", u1, v1, v2);
- // 3c.______________________________________
- int error = 666;
- fprintf(stderr,"A hibakod: %8X\n", error);
- // 4c.______________________________________
- double kiA[6] = {1.1,1.2,1.3,1.4,1.5,1.6};
- double beA[6];
- FILE* inputB;
- inputB = fopen("a.bin","wb");
- if(inputB == NULL){
- perror(inputB);
- }
- fwrite(kiA, 6*sizeof(double), 1, inputB);
- fflush(inputB);
- inputB = fopen("a.bin","rb");
- fread(beA, 6*sizeof(double), 1, inputB);
- fclose(inputB);
- int i;
- for(i = 0; i < (int) (sizeof(beA) / sizeof(*beA)); i++){
- printf("%.1lf ", beA[i]);
- }
- // i < 6 is boven eleg persze, csak igy "ujrafelhasznalhatobb"
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement