Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
glkink
/
C-programming
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3adb8783
authored
Jan 23, 2022
by
glkink
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
c7629136
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
0 deletions
valuutavahetus
valuutavahetus
0 → 100644
View file @
3adb8783
#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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment