Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Reading currencies from text file - how to highlight selection?

I would be really greatful if someone could point me in the right direction. So far I have a program which reads in a series of currencies from a text file. The user inputs a number 1 to 9 and this corresponds to a particular rate in the text file i.e. 1 =British pound etc. I was wondering if it is at all possible to highlight the users selection i.e. if they input 1 highlight the text British Pound, input 2 highlight the text Euro. Any suggestions would be much appreciated. I presume it would go in either one of these functions but im not entirely sure.
[CODE]
void convert(void)
{

gotoxy(20,17);
printf("Select currency to convert from ");

from=(getch()-48);
while(from<1 || from>9)
from=(getch()-48);

gotoxy(20,17);
printf(" ");

gotoxy(20,17);
printf("Select currency to convert to ");

to=(getch()-48);
while(to<1 || to>9)
to=(getch()-48);

gotoxy(20,17);
printf(" ");
gotoxy(20,17);
printf("Enter amount: ");
amount=gfloat();

gotoxy(20,19);
printf("%1.2f",(amount/rates[from-1])*rates[to-1]);
pause();
}

void read_file(float *rates)
{
char buff[80];
int i;

i=0;
while(fgets(buff,80,fpin)!=NULL)
{ // x y
gotoxy(17,7+i);
printf("%d %s",i+1,buff);
gotoxy(42,7+i);
printf("%d %s",i+1,buff);
if(fgets(buff,80,fpin)!=NULL)
rates[i++]=(float)atof(buff);
}
fclose(fpin);
}
[CODE]
Sign In or Register to comment.