I am trying to error check the user's input, but I can seem to get any IF statements to work. I've tried a simple statement and still get the same error, looking "(". Can someone help. Thanks.
/* Currency Conversion Program
Team Project by
*/
#include <stdio.h>
#include <stdlib.h>
#define peso 0.09174;
#define naira 0.007634;
#define nuevosol 0.29512;
#define ppeso 0.01793;
#define euro 1.20130;
int main ()
{ //declare variables
int response;
int quit;
int choice;
int amt;
int country;
int total;
float conversion;
//Title of Program
printf("\t\t\tCurrency Conversion Program\n\n");
//description of purpose
printf(" The following menu will allow you to select a country's currency to convert\n\n");
printf("\n\t\t\t\t into U.S. dollar\n\n");
while (choice != 6) //while menu option does not equal 6
{
total = 0; amt = 0;
total = total + amt; //keep running total
choice = 1,2,3,4,5,6;
//display menu option for user
printf("\n\t 1. Mexico's Pesos currency.\n");
printf("\n\t 2. Nigeria's Nairas currency.\n");
printf("\n\t 3. Peru's Nuevo Soles currency.\n");
printf("\n\t 4. Philippines' Pesos currency.\n");
printf("\n\t 5. Spain's Euro currency.\n");
printf("\n\t 6. Quit!\n");
//input a menu option
printf("\n\t Please enter the country of your choice. ");
// IF statement to error check range
if scanf("%d", &choice <= 0 || choice =>7)
{
printf("Invalid value, please try again!"\n);
continue;
}
// IF statement if user quits program
else if scanf("%d", &choice = 6)
{
printf("Thank you for using Currency Conversion Program ver 3.0.\n");
printf("Here is a total of converted currency in U.S. dollars: %.2f", total);
printf("\nPlease come back soon!\n");
}
printf("\n Now enter a currency amount: ");
scanf("%d", &amt);
total = total + amt;
switch (choice)
{
case 1:
printf("\n You have selected Mexico\n");
conversion = amt*peso;
printf("\n Your conversion amount is $ %.2f U.S. dollars.", conversion);
printf("\n\n\n");
break;
case 2:
printf("\n You have selected Nigeria\n");
conversion = amt*naira;
printf("\n Your conversion amount is $ %.2f U.S. dollars.", conversion);
printf("\n\n\n");
break;
case 3:
printf("\n You have selected Peru\n");
conversion = amt*nuevosol;
printf("\n Your conversion amount is $ %.2f U.S. dollars.", conversion);
printf("\n\n\n");
break;
case 4:
printf("\n You have selected Philippines.\n");
conversion = amt*ppeso;
printf("\n Your conversion amount is $ %.2f U.S. dollars.", conversion);
printf("\n\n\n");
break;
case 5:
printf("\n You have selected Spain.\n");
conversion = amt*euro;
printf("\n Your conversion amount is $ %.2f U.S. dollars.", conversion);
printf("\n\n\n");
break;
}
}
}