Advertisement
DrAungWinHtut

array_fileIO_vs.c

Nov 16th, 2022
815
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5.     FILE* fpoint;
  6.  
  7.     float A[4];
  8.     float L[4] = { 1.7,2.3,4.6,7.8};
  9.     float W[4] = { 5.2,4.1,1.6,6.8 };
  10.  
  11.     fopen_s(&fpoint, "I:\\test\\calculation.dat", "a");
  12.  
  13.     for (int i = 0; i < 4; i++)
  14.     {
  15.         A[i] = L[i] * W[i];
  16.         printf("\n%d L=%0.2f W=%0.2f A=%0.2f",i+1, L[i], W[i], A[i]);
  17.         fprintf_s(fpoint, "\n%d L=%0.2f W=%0.2f A=%0.2f",i+1, L[i], W[i], A[i]);
  18.     }
  19.    
  20.  
  21.    
  22.    
  23.     fclose(fpoint);
  24.  
  25.    
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement