Skip to content

Instantly share code, notes, and snippets.

@Shtille
Created March 27, 2016 15:54
Show Gist options
  • Save Shtille/8d1326525892206de92f to your computer and use it in GitHub Desktop.
Save Shtille/8d1326525892206de92f to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
const double trip_cost = 5000.0; // dollars
int main()
{
// Compute exchange rate deltas (using russian trader BCS for money exchange)
const double e_sell_today = 69.19;
const double e_buy_today = 67.20;
const double e_off_today = 68.43;
const double d_sell_bcs = e_sell_today - e_off_today;
const double d_buy_bcs = e_buy_today - e_off_today;
const double e_te = 70.14;
const double d_te = e_te - e_off_today;
double e1,e2,e3;
std::cout << "Input exchange rate at the day you would buy trip via tour agency: ";
std::cin >> e3;
std::cout << "Input exchange rate at the day you would buy dollars via BCS: ";
std::cin >> e1;
std::cout << "Input exchange rate at the day you would sell dollars via BCS: ";
std::cin >> e2;
std::cout << "-------------------------------------\n";
double cost_without_exchange = trip_cost * (e3 + d_te);
std::cout << "1) Trip cost without any money exchange: " << cost_without_exchange << " rubles\n";
double trip_cost_rubles = trip_cost * (e2 + d_te); // rubles
double dollars_need_to_buy_trip = trip_cost_rubles / (e2 + d_buy_bcs); // dollars in bank
double rubles_need_to_buy_dollars = dollars_need_to_buy_trip * (e1 + d_sell_bcs) + 1000.0;
std::cout << "2) Trip cost with money exchange: " << rubles_need_to_buy_dollars << " rubles\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment