Hi guys,

I am just learning c programming for the first time and having problems reading in a file into a 2d array.

The file contains the following:
1 euro
0.99 dollars
0.64 pounds
121.42 yen
4.65 shekels

I am trying to create a currency converter. When the user chooses to convert a currency, the program reads the releveant cell in the 2d array and performs the conversion. The amount converted to the new currency should be eisplayed back and the user given the option to convert a different amount to another currency.

The code I have already looks like this, I really need to know how to read the information in the file to a 2d array. Thanks in advance:
Code:
#include <stdio.h>
	


main()
{
	
	 

   void menu_option(); /* prototyping functions */
	char valid_c();
	char execute_option(char c);
	char c; 
fp=fopen("rates.txt", "wt+");
if (fp==NULL)
{
	printf("Error Opening File\n");
	return 0;
}
	
	menu_option();

			do {
				 
				  c=valid_c();
}
					
			while ( execute_option(c));
			
}

void menu_option()
{
    printf("\n***********************************");
	printf("\n	Currency Converter");
	printf("\n***********************************\n\n");
	printf("	C: Convert Money\n");
	printf("	U: Update Conversion Rates\n");
	printf("	X: Exit\n\n\n");
	printf("Please enter your choice or X to quit:\n");
}


char valid_c()

{
	char c;

	do {
			
		c=getchar();
	} while (c!='C' && c!='c' && c!='U' && c!='u' && c!='X' && c!='x');

	return (c);

}

char execute_option(char c)

{
	switch(c) {
					
	case 'c': printf("\n You have chosen to Convert Money\n");
			  break;
	case 'C': printf("\n You have chosen to Convert Money\n");
			  break;
	case 'U': printf("\n You have chosen to Update Conversion Rates\n");
			  break;
	case 'u': printf("\n You have chose to Update Conversion Rates\n");
			  break;
	case 'X': return (0);
	case 'x': return (0);
	}
	return (1);
}

&#91;code]&#91;/code]tagged by Salem