'if first input is larger than 2nd input it will choose 2 instead of 1

I'm having some trouble on my code if yourcurrency is larger than convert the convert will choose the 2 instead of 1

can't figure it out what's wrong with my code i've tried on different compiler I think the issue is the code itself can you help me guys?

#include <iostream>
#include <string>
using namespace std;

int picked[5] = {0,0,0,0,0};

int main(){
    string currentvalue[5][5] = {{"1","0.01818484","0.015423716","2.4462308","0.019060361"},{"55.012111","1","0.84815483","134.47933","1.0482778"},{"64.90818","1.1789799","1","158.58285","1.2359668"},{"0.40901121","0.0074303636","0.0063022858","1","0.0077907482"},{"52.511804","0.95391572","0.80907737","128.35738","1"}};
    string currency[5] = {"Philippine Peso","euro","pounds","yen","usd"};
    int yourcurrency;
    int convert;
    int timesToRun = 5;
    int number = 1;
    system("COLOR 0a");
    
    cout << "Choose your currency \n" << endl;
    
        for (int counter = 0 ; counter < timesToRun; counter++)
    {
        cout << number;
        cout << "." + currency[counter] << endl;
        number++;
    
        
    }
        cout << "\nOption: ";
        cin >> yourcurrency;
        system("CLS");
        yourcurrency = yourcurrency - 1;
        
        picked[yourcurrency] = 1;
    

            cout << "Select your currency you want to convert into \n" << endl;
     number = 1;
        
    for (int counter = 0; counter < timesToRun; counter++)
    {
        if (picked[counter] != 1){
        cout << number;
        cout << "." + currency[counter] << endl;
        number++;
        }
    }
    
        cout << "\nOption: ";
        cin >> convert;
        system("CLS");

    cout << currency[yourcurrency]+ " - " + currency[convert];
                    cout << " [" + currentvalue[yourcurrency][convert] + "] " << endl;
                    cout << "Amount: ";
                        int cash;
                        cin >> cash;
                        double value = stof(currentvalue[yourcurrency][convert]);
                        double total = cash * value;
                        cout << currency[convert]<< ": " << total;
    
}



Solution 1:[1]

I tested this with ansible-playbook version 2.12.1. Vars given later in the command will override earlier vars. So vars_c.yml would override vars in a and b.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 lhahne