aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorAlee <Alee14498@gmail.com>2019-01-29 16:40:33 -0500
committerAlee <Alee14498@gmail.com>2019-01-29 16:40:33 -0500
commitbeb447db2ffe03728d5ded11768e5f7fd5a2dc75 (patch)
tree9d977dc99269fd27bed2fb11b18affc58e2ff77f /main.cpp
parent1ca25b55458d6c68ce15d4afaf10ae1f7b093568 (diff)
downloadProject-Xeon-beb447db2ffe03728d5ded11768e5f7fd5a2dc75.tar.gz
Project-Xeon-beb447db2ffe03728d5ded11768e5f7fd5a2dc75.tar.bz2
Project-Xeon-beb447db2ffe03728d5ded11768e5f7fd5a2dc75.zip
added JSON (alpha)
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/main.cpp b/main.cpp
index f895c13..9413d9c 100644
--- a/main.cpp
+++ b/main.cpp
@@ -3,39 +3,38 @@
#include <string>
#include <fstream>
#include <stdlib.h>
+#include "dependencies/nlohmann/json.hpp"
+
+using json = nlohmann::json;
int main()
{
int age;
int year;
- std::string guy;
+ std::string username;
int mainChoice;
- std::ofstream db;
- db.open("database.txt");
-
- std::string warningText = "Please note that this will be not permanent, we are planning to add a encrypted save file.\n";
-
- db << warningText;
+ std::ifstream i("database.json");
+ json j;
+ i >> j;
std::cout << "Welcome to Project Xeon! A text-based game made in C++!" << std::endl;
std::cout << "Please enter your name..." << std::endl;
- std::getline(std::cin, guy);
- std::cout << "Hello "<< guy << "!" << std::endl;
- db << guy;
+ std::getline(std::cin, username);
+ std::cout << "Hello "<< username << "!" << std::endl;
+ j["username"] = username;
std::cout << "Press anything to continue!" << std::endl;
system("pause>nul");
system("cls");
std::cout << "Select a year that you will be born in..." << std::endl;
std::cin >> year;
- db << year;
+ j["year"] = year;
std::cout << "The year is now " << year << "!" << std::endl;
system("pause>nul");
age = 0;
age = age+1;
year = year+1;
-
- db.close();
+
std::cout << "You are now " << age << " and it's " << year << std::endl;
system("pause");
return 0;