Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- float cm;
- float inch;
- int valg;
- float convert_to_inch()
- {
- printf("Hvor mange cm vil du konvertere ti inches?");
- scanf_s("%f", &cm);
- inch = cm / 2.54;
- printf("%f cm tilsvarer %f inches", cm, inch);
- return 0;
- }
- float convert_to_metric()
- {
- printf("Hvor mange inches vl du konvertere til cm?");
- scanf_s("%f", &inch);
- cm = inch*2.54;
- printf("%f inches tilsvarer %f cm", inch, cm);
- return 0;
- }
- int main()
- {
- printf("Tast 1 for CM-INCHES\n Tast 2 INCHES-CM\n");
- scanf_s("%d", &valg);
- switch (valg)
- {
- case 1:
- convert_to_inch;
- system("Pause");
- case 2:
- convert_to_metric;
- system("pause");
- default:
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement