forked from Syntax-Error/TradeSim
Added Market class
This commit is contained in:
parent
08e2a8568a
commit
4785879a8b
3 changed files with 38 additions and 1 deletions
|
@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD 14)
|
|||
|
||||
add_subdirectory(external/curl)
|
||||
add_subdirectory(external/jsoncpp)
|
||||
add_executable(TradeSim main.cpp)
|
||||
add_executable(TradeSim main.cpp src/Currency.cpp src/Currency.h src/Market.cpp src/Market.h)
|
||||
target_link_libraries(TradeSim libcurl)
|
||||
target_link_libraries(TradeSim jsoncpp_lib)
|
||||
include_directories(${CURL_INCLUDE_DIR})
|
||||
|
|
13
src/Market.cpp
Normal file
13
src/Market.cpp
Normal file
|
@ -0,0 +1,13 @@
|
|||
#include "Market.h"
|
||||
|
||||
Market::Market(Currency *rhs, Currency *lhs) : rhs(rhs), lhs(lhs) {
|
||||
name = rhs->getName() +'/'+ lhs->getName();
|
||||
}
|
||||
|
||||
const std::string &Market::getName() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
double Market::getExchangeRate() const {
|
||||
return exchange_rate;
|
||||
}
|
24
src/Market.h
Normal file
24
src/Market.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
#ifndef TRADESIM_MARKET_H
|
||||
#define TRADESIM_MARKET_H
|
||||
#include <string>
|
||||
|
||||
#include "Currency.h"
|
||||
|
||||
//! Különböző valuták átváltására használt piac
|
||||
class Market {
|
||||
//! Piac neve
|
||||
std::string name;
|
||||
//! Átváltási ráta
|
||||
double exchange_rate;
|
||||
//! Ez az amiért vásárolunk
|
||||
Currency* rhs;
|
||||
//! Ezt vásároljuk
|
||||
Currency* lhs;
|
||||
public:
|
||||
Market(Currency *rhs, Currency *lhs);
|
||||
const std::string &getName() const;
|
||||
double getExchangeRate() const;
|
||||
};
|
||||
|
||||
|
||||
#endif //TRADESIM_MARKET_H
|
Loading…
Reference in a new issue