HOW TO GET WEATHER FORECAST OF ANY COUNTRY USING C# CONSOLE APPLICATION

HOW TO GET WEATHER FORECAST DETAIL OF ANY COUNTRY USING C# CONSOLE APPLICATION

NOTE:
  • YOU NEED TO HAVE MICROSOFT VISUAL STUDIO (2010 OR NEWER VERSION) OR YOU CAN HAVE ANY PLATFORM WHICH SUPPORTS C# CONSOLE APPLICATION.

  • AFTER CREATING THE PROJECT, FIRST ADD THE LIBRARIES:
  1. using System.Net;
  2. using System.IO;
  3. using System.Diagnostics;
  4. using System.Threading;

NOW,

Write or paste the following code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Net;
using System.IO;
using System.Diagnostics;
namespace weatherforecaster
{
    class Program
    {
        static void Main(string[] args)
        {
            string search;
            Console.WriteLine("Enter the country name to search about its Weather details:");
            search = Console.ReadLine();
            searchweather(search);
        }
        static void searchweather(string country_name)
        {
            Process.Start("https://www.weather-forecast.com/locations/"+country_name+"/forecasts/latest");
        }
    }
}

IT'LL PRODUCE THE FOLLOWING OUTPUT:





Comments

Popular Posts

Contact Form

Name

Email *

Message *