Pinging Google and reading from file

Hi I am a C++ beginner, and I am wondering how it would be possible to program an android/web app.

For example, in the app a user would have an account established, and the his location and stats, all decided at runtime with user input.

What resources can I look into (or specific operations) that would allow me to ping google with a query, for example, "___ current weather" where blank is user's established location, say Toronto. And then, take the result, for example current weather in Toronto is 4 degrees, and output "Current weather in Toronto -- 4 degrees"

Is this even possible? Am I merging into API territory here?

Last edited on
Is this even possible? Am I merging into API territory here?
Yes and yes. An API is just an interface to another system or subsystem.

For example:
Ah, I see.

On a more practical note, I just finished my intro to OOP course, and I want to create an app, compatible for Android and Web, (maybe iPhone if I ever learn Xcode or React haha).

Say Im interested in this:

I want my C++ program to read from this API call, and in a loop create instances of a class. In my case, the constructor would be called like so,

Coins XRP("XRP", "Ripple", 1.72);

where the constructor is defined as,

	class Coins {
		string id;
		string fullName;
		double price;
		long long supply = 1000000000; //tentative
			Coins(const char* _id, const char* _fullName, const double _price);
		        //other stuff

        Coins::Coins(const char* _id, const char* _fullName, const double _price) {
                id = _id;
                fullName = _fullName;
                price = _price;

Ideally, I would want to have those values generated for me.. I mean, I could use a CSV file, and then use std::getline but that is inefficient. How can I merge an API call, extract from the JSON file the ID, Name and Price elements, and afterwards construct the coins with the extracted data?
Last edited on
Webservices tend to use a REST API.

So, if you want to talk to it from C++, you need to use the REST protocol. Unfortunately, C++ really sucks when it comes to good libraries, which is odd given that C++ is a language for writing libraries. There's this REST client ( ). But these things in C++ are never as easy to use as they are in other languages (like Ruby).

You can test the API with a REST plugin for your browser.
I understand, that's the general tone Im getting when I read through API related programming. I see you've listed Ruby; are C# and Java feasible languages to do this in? Ill be studying those two in school this semester, but if Ruby is better I will study Ruby on my own time as well.
Java yes, because it's the native language of Android. C#? If you use Windows, then yes. But these are client side reasons.

On the server, you typically don't have these restraints, unless you've opted to use Windows to run your server.
Topic archived. No new replies allowed.