Skip to content

Instantly share code, notes, and snippets.

@DragonOsman
Last active May 19, 2018 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DragonOsman/92bb7ebbc441047b6bacfe823e876f4d to your computer and use it in GitHub Desktop.
Save DragonOsman/92bb7ebbc441047b6bacfe823e876f4d to your computer and use it in GitHub Desktop.
Wt Hello World
// Osman Zakir
// 4 / 4 / 2018
// currency_converter_app main.cpp
// This is a currency converter web application written in Wt. The GUI is a Google Map with an info window that displays a form
// The form takes the user's input for what currencies to convert to and from, respectively, and the amount to convert. The form submits
// to the executable made by this C++ code file
#include <Wt/WApplication.h>
#include <Wt/WServer.h>
#include <Wt/Http/Client.h>
#include <Wt/Http/Request.h>
#include <Wt/Http/Response.h>
#include <Wt/Json/Serializer.h>
#include <Wt/Json/Parser.h>
#include <Wt/Json/Array.h>
#include <Wt/Json/Object.h>
#include <Wt/Json/Value.h>
#include <Wt/WString.h>
#include <Wt/WEnvironment.h>
#include <Wt/WTemplate.h>
#include <Wt/WContainerWidget.h>
#include <Wt/WJavaScript.h>
#include <cstdlib>
class CurrencyConverterApp : public Wt::WApplication
{
public:
CurrencyConverterApp(const Wt::WEnvironment &env);
};
int main(int argc, char *argv[])
{
return Wt::WRun(argc, argv, [](const Wt::WEnvironment &env) {
return std::make_unique<CurrencyConverterApp>(env);
});
}
CurrencyConverterApp::CurrencyConverterApp(const Wt::WEnvironment &env)
: Wt::WApplication{ env }
{
char *apikey = std::getenv("apikey");
char *accesskey = std::getenv("accesskey");
}
double convert(const double amount, const std::string &to_currency)
{
// TODO: Try to match passed in to_currency with array of supported currencies
// and do the conversion for the currency that checks out. Return the result.
return 0.0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment