Animaonline Weather API - Tutorials - C++ (CPP CLR)

Tutorial
  • Start Visual Studio
  • Go to "File" --> "New" --> "Project" --> "Other Languages" -> "C++" -> "CLR Console Application"
  • Click OK
Now you will have to add the Animaonline Weather API Library to your project's reference list
  • Go to "Project" --> "References..." --> "Add New Reference..." -> Open the "Browse" tab, and browse for the compiled Animaonline Weather API Library --> "OK"
Now you are set to start writing some code.

Add the following code to the application's int main
	Animaonline::WeatherAPI::WeatherData^ wD = gcnew Animaonline::WeatherAPI::WeatherData(Animaonline::WeatherAPI::LanguageCode::en_US,"Phoenix, AZ");
	Console::WriteLine("Condition:{0} Temperature:{1}°F {2}°C", wD->condition, wD->temp_f, wD->temp_c);

The application will look like this when you're done
#include "stdafx.h"
 
using namespace System;
 
int main(array<System::String ^> ^args)
{
	Animaonline::WeatherAPI::WeatherData^ wD = gcnew Animaonline::WeatherAPI::WeatherData(Animaonline::WeatherAPI::LanguageCode::en_US,"Phoenix, AZ");
	Console::WriteLine("Condition:{0} Temperature:{1}°F {2}°C", wD->condition, wD->temp_f, wD->temp_c);
}
  • Now start your application by pressing Ctrl + F5

If you encounter any errors , feel free to ask in the forums.

P.S. For a full list of properties refer to API Overview page.

Programmed by Roman Alifanov, uses Google's Weather Feed, licensed under GNU General Public License version 2
© 2007-2009 Roman Alifanov

Last edited Jul 31, 2009 at 1:28 PM by animaonline, version 6

Comments

No comments yet.