Commit 3adb8783 by glkink

Add new file

parent c7629136
Showing with 73 additions and 0 deletions
#include <stdio.h>
#include<ctype.h>
#include<stdlib.h>
#include<string.h>
int main()
{
double summa, kokku = 0.0;
char valuuta[5];
printf("Sisesta valuuta (USD, GBP, AUD jne): ");
scanf("%s", valuuta);
printf("Sisesta summa: ");
scanf("%lf", &summa);
char ccode[5];
double hind, valuu;
FILE *fail = fopen("valuuta.txt" , "r");
if (fail == NULL) {
printf("Ei saa faili avada!\n");
return 1;
}
int labi = 0;
{
while(fscanf(fail, "%s %lf %lf", ccode, &hind, &valuu) != EOF)
{
if( strcmp(valuuta, ccode) == 0)
{
kokku = ((1/valuu)*summa) - hind;
labi = 1;
}
if(labi == 1)
break;
}
}
fclose(fail);
printf("\nVaartus on %s\n %0.2lf\n", valuuta, kokku);
return 0;
}
/*AED 4.19700 4.07300
AUD 1.57700 1.53950
BGN 1.97750 1.93450
CAD 1.45100 1.41650
CHF 1.06000 1.03700
CNY 7.28350 7.09700
CZK 25.72910 25.12250
DKK 7.51100 7.36250
GBP 0.85100 0.83350
HKD 8.88700 8.66000
HRK 7.63900 7.41450
HUF 377.00655 365.94580
JPY 130.84655 127.76185
NOK 10.18700 9.98600
PLN 4.81400 4.62650
RON 5.02400 4.87600
RUB 85.44000 83.26110
SEK 10.21550 10.01350
SGD 1.56100 1.51450
TRY 14.66100 13.29750
USD 1.13700 1.11450
ZAR 18.03500 17.50550
*/
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment