This program won't print the menu number the user enters???

/* Currency equivalence to the Dollar*/
#include <stdio.h>


float Australian_Dollar; //Australian Dollar
float Euro; //Euro Dollar
float British_Pound; //British_Pound Dollar
float Japanese_Yen; //Japanese_Yen Dollar
float Swiss_Franc; //Swiss_Franc Dollar


float count;
int menunum;



/* Dollar conversion */


int main(void)
{ // A
/* 13 */
int menunum;    /*Defines the menunum as an integer for the scanf  */
int final1;


while (menunum != 0) {// Starts the quit function
printf (" Select a currency by entering a the number beside the currency. \n\n");
printf(" Enter q to quit.\n\n");


printf (" 1. Australian Dollar \n");


printf (" 2. Euro \n");


printf (" 3. British Pound \n");


printf (" 4. Japanese Yen \n");


printf (" 5. Swiss Franc \n"); /* 28 */


scanf("%f", &menunum); /* 30  Users enters the number on the menu bar */


if (menunum == 1){
printf("%f\n", Australian_Dollar);
}  /* Australian_Dollar */


else if (menunum == 2) {
printf("%f\n", Euro);
}
else  if (menunum == 3) {
printf("%f\n", British_Pound);
} /* 41   British_Pound */


else if (menunum == 4) {
printf("%f\n", Japanese_Yen);
} /* Japanese_Yen */


else if (menunum == 5) {
printf("%f\n", Swiss_Franc);
} /* 51 Swiss_Franc */


else {
printf("Choose another or quit.\n");
}


Australian_Dollar = 1.43;  //    50  Define Australian dollar


Euro = 0.83;  // Define Euro currency


British_Pound = 0.55; // Define British Pound


Japanese_Yen = 110.9; // Define Janpanese Yen


Swiss_Franc = 1.28; // Define Swiss Franc


scanf("%f", &final1); /* 30  Users enters the number on the menu bar */


}
return 0;


}   //A

Hi, I did not try to run it but, you declared menunum as an Integer right?

scanf("%f", &menunum); /* 30 Users enters the number on the menu bar */

On that line, menunum should be scanned as %d?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.