c++ Json Lesson. Open office setting. People listening attentively to a seated leader

C++ Json

C++ Json libraries There are at least 3 major, well used c++ json libraries used for reading and writing to json data structures. Our plan is not to use any of them. We are going to first focus on what a json structure looks like, then look at how we might traverse such a structure in much the same way that a javascript coder might do so. But for those who are looking for a c++ json reader that...
Read More
c++ Json Lesson. Open office setting. People listening attentively to a seated leader

C++ file io – Part 2

The CSV format - c++ file io In the last article, we were looking at this csv file format that was contrived into the coding below. There are definitely better ways of doing these things, but that was a quick dirty test. Lets do it better, but first lets once more show the contrived version. #include <fstream> using namespace std; int main(){ string st1 = "'George','Stevens',89,56,90,85\n";...
Read More
c++ file io administration

C++ file io Management

C++ file io management - what that really means File management in any language really means - "How we store the data that is important to us". In C and C++ this could also technically mean storing data to a stream, where that stream could be a file or could be some kind of output such as a console, network, printer, live video stream, etc.In our case, the how will be straight storage as well as...
Read More

c++ Thread Example

In this c++ thread example, we wrap a class object in a thread and execute it while running a loop from the main thread. std::thread myThread(ShowMeTheThread());...myThread.join() // Why wrap a process or class in a c++ thread? Generally, we would run a method or class in a thread when it either has a long running task or when something is going to probably stop it which if it were run in the...
Read More

C++ Random Generator

True c++ random number generators for computers are difficult to come by, but one that will suit most intents and purposes can be found here. The function searched for by most frequently by c++ random or c++ srand time . #include <ctime>srand(time(0)); // seed the random number generator with your clockint x = rand() % 15 + 1; // Numbers from 1 to 15Do not use for real money casino games...
Read More

C++ Sort Vector

The C++ sort vector does a remarkable job of sorting though it doesn't guarantee the sort order of items that started with the same value. myVector = {102,30, 298, 2, 42};sort( myVector.begin(),myVector.end() ); // Example program #include <iostream> #include <string> #include <algorithm> // sort is not going to run without this int main() { std::vector<int> sortMyValues =...
Read More
Top