Advertisement
Alx09

Untitled

Mar 19th, 2022
1,292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int main() {
  6.     FILE * input;
  7.     FILE * output;
  8.     input = fopen("in.txt", "r");
  9.     output = fopen("out.txt", "w");
  10.     float multiplicator;
  11.     printf("Multiplicator: "); scanf("%f", &multiplicator);
  12.     int openInt, endInt;
  13.     printf("a= : "); scanf("%d", &openInt);
  14.     printf("b= : "); scanf("%d", &endInt);
  15.     char name[100];
  16.     float salar;
  17.     while (fscanf(input, "%[^,]s", &name) != EOF) {
  18.         fscanf(input, "%*c");
  19.         fscanf(input, "%f", &salar);
  20.        
  21.    
  22.         if (salar >= openInt && salar <= endInt)
  23.             fprintf(output, "%s, %f", name, multiplicator * salar);
  24.         else
  25.             fprintf(output, "%s, %f", name, salar);
  26.        
  27.     }
  28.    
  29.     system("pause");
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement