My name is Osman Zakir. Email address osmanzakir90@hotmail.com. I also have a Gmail account, and the email address for that one is osmanzakir9@gmail.com.
I'm also between beginner and intermediate and in need of coding friends. A mentor would also be good. I'm reading the book Programming: Principles and Practice Using C++ 2nd Edition by Bjarne Stroustrup, but I think I could use some actual mentoring which is why I'm asking for that.
I took an intro CS course edx.org, Introduction to Computer Science (CS50), given by Harvard. I need to do the Final Project for that course now, for which I'm planning to use the C++ Wt library to create a web app.
For the web app itself, I was thinking of using an exercise I'd done for the book I'm reading as a base. It's a currency convertor, but I have to manually update the conversion rates myself. I wanted to create a web application that would take the conversion rates from the web in real time. And for the user interface, I was thinking of using the Google Maps API. What I have in mind is that the app would take the user's geolocation to show them where they are on the map, as well as their own currency converted to any other currency of their own choosing.
The currency convertor app I'm thinking of using as a base takes in a currency as user input and converts it to USD. I wanted to specialize it a little more and make it more flexible, such that if the user is in the US, they could look at how much a US Dollar is worth in other countries for example, or if they're outside the US, they could check how much their own currency is worth in the US or in any other country. And of course, the original app is just a console app. For reference, here's the code for the aforementioned base/original app (note: conversion rates haven't been updated since I last wrote the code):
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
// Osman Zakir
// 12 / 5 / 2016
// Bjarne Stroustrup: Programming: Principles and Practice Using C++ 2nd Edition
// Chapter 4 Section 4.4.1.1 Try This Exercise
// This program converts from Yen, Euros, Yuan, Kroner, or Pounds to Dollars
#include "../../std_lib_facilities.h"
double convert(const char unit, const double amount);
bool check_input(const char unit);
int main()
{
cout << "Please enter a money amount followed by currency (y(en), e(uro), p(ound),\n"
<< "(k)roner, or Y(uan) (must be an uppercase Y, to make sure to not clash with"
<< "lowercase y for y(en)):\n";
double amount = 0;
char unit = ' ';
cin >> amount >> unit;
if (!check_input(unit))
{
cout << "Sorry, I don't know a unit called '" << unit << "'\n";
return 1;
}
double dollars = convert(unit, amount);
cout << "Your money converted to US Dollars is $" << dollars << ".\n";
keep_window_open();
}
double convert(const char unit, const double amount)
{
constexpr double yen_to_dollar = 114.239139;
constexpr double euro_to_dollar = 0.927889;
constexpr double pound_to_dollar = 0.785687;
constexpr double yuan_to_dollar = 0.143708;
constexpr double krone_to_dollar = 0.140471;
double dollars = 0;
switch (unit)
{
case 'y':
dollars = amount / yen_to_dollar;
break;
case 'e':
case 'E':
dollars = amount / euro_to_dollar;
break;
case 'p':
case 'P':
dollars = amount / pound_to_dollar;
break;
case 'Y':
dollars = amount * yuan_to_dollar;
break;
case 'k':
case 'K':
dollars = amount * krone_to_dollar;
}
return dollars;
}
bool check_input(const char unit)
{
if (unit == 'y' || unit == 'e' || unit == 'p' || unit == 'Y' || unit == 'k')
{
return true;
}
return false;
}
|
If there's anyone on here or in the group who could help me learn Wt, that would also be a great help. I'm also reading up stuff on the Wt website, but I could use the experience from writing some code myself using Wt.