M
Mike
Hello,
This program uses C. It is meant to convert whatever the current
exchange rate is to dollars. It compiles, builds, and executes
correctly except for a few bugs. When building I get an error that
states;
Linker Error (Severity 4)
Module "a" in file "c:\program files\miracle c\yendollarext.obj"
references unresolved external "_rewind"
at offset 0303H in segment "_text".
I am not sure how to resolve this error.
Also, I attempted to have the program create an error whenever someone
either "chooses" a number higher than 1 "else if(choice > '1')" or
attempts to use an alpha character
"if (isalpha(yen))
{
printf("\n Sorry, that was not a valid option.\n\n");"
break;
in which the program shuts down without displaying the error message.
Any ideas? Here is the code, all help is appreciated.
#include <stdio.h>
#define DRAINO rewind(stdin);fflush(stdout);
#define STOP rewind(stdin); getchar();
int main( void )
{
double yen = 0.0;
double dollars = 0.0;
double yentoDollar = 0.0;
int choice=0;
printf("\nYen to Dollar Currency Conversion\n\n");
printf("Enter 1 to begin Conversionn\n");
printf("Enter 0 to Quit the Program\n\n");
printf("Please select your option:\n\n");
scanf("%d", &choice);
if (choice == 1)
{
printf("\nYou want to convert Yen into US dollars.\n\n");
printf("Please enter the current exchange rate between Dollars and
Yen.\n\n");
scanf( "%lf", ¥toDollar );
if (isalpha(yentoDollar))
{
printf("Sorry, that was not a valid option.");
getchar ();
break;
}
printf("\nHow many Yen do you have?\n\n");
scanf( "%lf", ¥ );
if (isalpha(yen))
{
printf("\n Sorry, that was not a valid option.\n\n");
break;
}
dollars = yen * yentoDollar;
printf( "\nThe conversion to US dollars of %.2f yen is %.2f
dollars\n", yen, dollars );
rewind(stdin);
getchar();
}
else if (choice == 0)
{
printf("Program will terminate after you click Enter.\n");
printf("\nHave a nice day!");
getchar ();
return 0;
}
else if(choice > '1')
{
printf("\nProgram will terminate after you click Enter.\n");
printf("\nHave a nice day!");
getchar ();
return 0;
}
}
Thanks in advance!
Mike
This program uses C. It is meant to convert whatever the current
exchange rate is to dollars. It compiles, builds, and executes
correctly except for a few bugs. When building I get an error that
states;
Linker Error (Severity 4)
Module "a" in file "c:\program files\miracle c\yendollarext.obj"
references unresolved external "_rewind"
at offset 0303H in segment "_text".
I am not sure how to resolve this error.
Also, I attempted to have the program create an error whenever someone
either "chooses" a number higher than 1 "else if(choice > '1')" or
attempts to use an alpha character
"if (isalpha(yen))
{
printf("\n Sorry, that was not a valid option.\n\n");"
break;
in which the program shuts down without displaying the error message.
Any ideas? Here is the code, all help is appreciated.
#include <stdio.h>
#define DRAINO rewind(stdin);fflush(stdout);
#define STOP rewind(stdin); getchar();
int main( void )
{
double yen = 0.0;
double dollars = 0.0;
double yentoDollar = 0.0;
int choice=0;
printf("\nYen to Dollar Currency Conversion\n\n");
printf("Enter 1 to begin Conversionn\n");
printf("Enter 0 to Quit the Program\n\n");
printf("Please select your option:\n\n");
scanf("%d", &choice);
if (choice == 1)
{
printf("\nYou want to convert Yen into US dollars.\n\n");
printf("Please enter the current exchange rate between Dollars and
Yen.\n\n");
scanf( "%lf", ¥toDollar );
if (isalpha(yentoDollar))
{
printf("Sorry, that was not a valid option.");
getchar ();
break;
}
printf("\nHow many Yen do you have?\n\n");
scanf( "%lf", ¥ );
if (isalpha(yen))
{
printf("\n Sorry, that was not a valid option.\n\n");
break;
}
dollars = yen * yentoDollar;
printf( "\nThe conversion to US dollars of %.2f yen is %.2f
dollars\n", yen, dollars );
rewind(stdin);
getchar();
}
else if (choice == 0)
{
printf("Program will terminate after you click Enter.\n");
printf("\nHave a nice day!");
getchar ();
return 0;
}
else if(choice > '1')
{
printf("\nProgram will terminate after you click Enter.\n");
printf("\nHave a nice day!");
getchar ();
return 0;
}
}
Thanks in advance!
Mike