Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <string.h>
- int main()
- {
- float coinsValue, notesValue, totalMoney;
- int switchValue;
- char originalMoney, convertedMoney;
- printf("Enter original money typen");
- scanf("%c",&originalMoney);
- printf("Enter the type of money you want to convertn");
- scanf("%c",&convertedMoney);
- if (strcmp(originalMoney, "REAL") == 0 && strcmp(convertedMoney, "DOLLAR") == 0){
- switchValue = 1;
- } else if (strcmp(originalMoney, "REAL") == 0 && strcmp(convertedMoney, "LIBRAS")){
- switchValue = 2;
- } else if (strcmp(originalMoney, "DOLLAR") == 0 && strcmp(convertedMoney, "REAL")){
- switchValue = 3;
- } else if (strcmp(originalMoney, "DOLLAR") == 0 && strcmp(convertedMoney, "LIBRAS")){
- switchValue = 4;
- } else if (strcmp(originalMoney, "LIBRAS") == 0 && strcmp(convertedMoney, "REAL")){
- switchValue = 5;
- } else if (strcmp(originalMoney, "LIBRAS") == 0 && strcmp(convertedMoney, "DOLLAR")){
- switchValue = 6;
- } else {
- printf("You have chosen an invalid conversion option!");
- }
- switch (switchValue) {
- case 1:
- printf("Entering case 1...n");
- printf("Enter coins value in R$: n");
- scanf("%f",coinsValue);
- printf("Enter notes value in R$: n");
- scanf("%f",notesValue);
- totalMoney = coinsValue + notesValue;
- totalMoney = totalMoney * 4.01;
- printf("The value in reais converted to dollar is: %.2f",totalMoney);
- break;
- case 2:
- printf("Entering case 2...n");
- break;
- case 3:
- printf("Entering case 3...n");
- break;
- case 4:
- printf("Entering case 4...n");
- break;
- case 5:
- printf("Entering case 5...n");
- break;
- case 6:
- printf("Entering case 6...n");
- break;
- }
- return 0;
- }
- char originalMoney[10];
- scanf("%s9", &originalMoney);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement