downloaded JSON.HPP file and I need to be sparking this File . I need to first spark out “Titles”. And then on these keys, sparking already “irises”.
That’s what I have happened.
# include & lt; iostream & gt;
#Include & lt; vector & gt;
#Include & lt; String & GT;
#Include & lt; fstream & gt;
#Include & lt; unordered_map & gt;
#include "json.h"
Using Namespace nlohmann;
Using Namespace STD;
INT MAIN () {
Ifstream SRC ("Irises.json");
JSON JSN;
SRC & GT; & GT; jsn;
Const Auto & Amp; irises = jsn ["Irises"];
Const Auto & Amp; Titles = jsn ["titles"];
Return 0;
}
During the program, I need to get the values of the signs of each flower.
Tell me how I can resolve this file, give an example code.
Answer 1, Authority 100%
It is all Parsit itself. Here is an example, as you can take and remove in the form of a table (primitive of course, but still).
int main () {
Ifstream SRC ("Irises.json");
JSON JSN;
SRC & GT; & GT; jsn;
Const Auto & Amp; irises = jsn ["Irises"];
Const Auto & Amp; Titles = jsn ["titles"];
Std :: Vector & lt; Std :: String & GT; title; // Array of headlovkov
For (Const Auto & Amp; T: TITLES) {
STD :: STRING S = T;
title.push_back (s); // Fill it
}
For (Const Auto & Amp; IR: Irises) {
STD :: COUT & LT; & LT; IR ["Class"]; // Display name
For (Const Auto & Amp; ST: TITLE) {
STD :: COUT & LT; & LT; "\ t" & lt; & lt; IR [ST]; // Use the array of headers
}
STD :: COUT & LT; & LT; "\ n"; // Well, the row translation
}
Return 0;
}