Computing.Net > Forums > Programming > C++ array help needed

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

C++ array help needed

Reply to Message Icon

Original Message
Name: Karsten
Date: February 10, 2003 at 23:10:22 Pacific
Subject: C++ array help needed
OS: Win 98 + WinXP
CPU/Ram: 800MHz 256 SDram
Comment:

Hello,
I am currently trying to teach myself a bit of C++ through programming some simple apps and now I am stuck on two multi-dimensional arrays. This will later become a simple win32 based currency conversion program and I just dont yet know enough about arrays to make it work without hard-coding it (I want to keep the program flexible so hard-coding the calculations is not an option ;p)
Here is what I have so far:
#include
#include
using namespace std;

char currency[][20] = {{"USD","HKD","TB"}{"USD","HKD","TB"}};
double convert[][20] = {{1,5,42.86}{1,5,42.86}};

char displayscreen(char, double);
{
char clearscreen(char);
{
cout(32,"\n");
}

char menu(char);
{
cout "Please Select an Operation:"
"\t\tA: Currency Conversion"
"\t\tB: Add Currency"
"\t\tC: Update exchange rates" endl;
cin;
}

char menuchoice(char);
{
switch (menu);
{
case 'a':
case 'A':
convert();
break;

case 'b':
case 'B':
addcurrency();
break;

case 'c':
case 'C':
upchange();
break;
}
}

double convert(double);
{
cout "From which currency would you like to convert" endl;
cin;
cout "into what currency would you like to convert:" endl;
cin;

This is still a testing version so please dont worry about possible coding errors as I will correct the test once i finished all functions.
What I need the program to do for the conversion fuction is to take a keyboard input from the user and compare the char value with the values in the currency array. both arrays are ordered in the same way so that than the currency array has to parse the row/column value to the conversion array to get the exchange rate for the actual calculation. But as I said before I have absolutly no clue how to put this into code so please help if you can.
PS: Sorry for the length of this thread.


Report Offensive Message For Removal








Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you own an iPhone?

Yes
No, but soon
No


View Results

Poll Finishes In 7 Days.
Discuss in The Lounge
Poll History




Data Recovery Software