Currency Conversion Calculator

I'm halfway into my assignment and I'm not sure what else to do, how to finish the assignment. I'm currently quarantined at home and don't have anyone to ask for help.

Here are my instructions I was given: "As always, use strong variable names and write clean, clear, professional user interaction.

The goal is to write a currency conversion calculator.

1) Create a vector of nations. The US should be at Index 0. There should be at least five others.

2) Write a vector of national currencies. They must all be different. They should be entered in the same order as the nations.

3) Write a vector of conversion rates. They should be entered in the same order as the nations.

4) Set a variable currencyCurrent and set the value to 0. This represents the default of Index 0 for the United States in each of the three vectors.

5) Set a variable for the date on which you captured the currency rate.

6) Use a function to present the user with a list of the nations and currencies they can choose from, as well as the date of the last captured conversion rate.

7) Ask them what currency that want to convert to.

8) Ask them how much money in US Dollars (and cents) they want to convert.

9) Use a function to calculate the new value of their currency.

10) Use another function to report the new currency value.

A good test of this will be be choosing to convert to US Dollars, which should result in the same amount as they entered."



And here's the code I have so far:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 // I'm limited to these libraries.
#include <iostream>
#include <vector>

double currencyRates() {

  std::vector<double> rates = {1, 103.30, 0.89, 6.33, 4.06, 1198.94};;

}

double userValue (double firstCurrency, double secondCurrency) {

  double totalValue = firstCurrency * secondCurrency;

  return totalValue;

}

void print(std::vector<std::string> const &input) {

  for (int i = 0; i < input.size(); i++) {
    std::cout << input.at(i) << ", ";
   }

}

int main() {

  std::vector<std::string> nations = {"United States", "Afghanistan", "France", "China", "Poland", "South Korea"};;

  std::vector<std::string> nationCurrencies = {"Dollars", "Afghan afghani", "Euro", "Yuan", "Złoty", "Won"};;

  int currencyCurrent = 0;
  std::string date = "January 25, 2022";
  double userCurrency;
  int userMoney;
  
  std::cout << "Here is a list of nations available: \n";
  print(nations);
  std::cout << "\nAnd here are there currencies: \n";
  print(nationCurrencies);

  std::cout << "\nWhat currency would you like to convert to?\n";
  std::cin >> userCurrency;
  std::cout << "How many US dollars (and cents) do you want to convert?\n";
  std::cin >> userMoney;

  double userValue(userMoney, double currencyRates());

}


I would greatly appreciate it if I were to get some pointers or tips.
Last edited on
Topic archived. No new replies allowed.