Created
May 8, 2025 16:38
-
-
Save Mark-Uri/ed0e7758ab007baa9f7853272217b55b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
class Program | |
{ | |
static async Task Main() | |
{ | |
Console.Title = "Гороскоп: сделайте выбор знака"; | |
Console.WriteLine("Выбор:"); | |
Console.WriteLine("1 - Aries"); | |
Console.WriteLine("2 - Taurus"); | |
Console.WriteLine("3 - Gemini"); | |
Console.WriteLine("4 - Cancer"); | |
Console.WriteLine("5 - Leo"); | |
Console.WriteLine("6 - Virgo"); | |
Console.WriteLine("7 - Libra"); | |
Console.WriteLine("8 - Scorpio"); | |
Console.WriteLine("9 - Sagittarius"); | |
Console.WriteLine("10 - Capricorn"); | |
Console.WriteLine("11 - Aquarius"); | |
Console.WriteLine("12 - Pisces"); | |
string choise = ""; | |
switch (Console.ReadLine()) | |
{ | |
case "1": choise = "Aries"; break; | |
case "2": choise = "Taurus"; break; | |
case "3": choise = "Gemini"; break; | |
case "4": choise = "Cancer"; break; | |
case "5": choise = "Leo"; break; | |
case "6": choise = "Virgo"; break; | |
case "7": choise = "Libra"; break; | |
case "8": choise = "Scorpio"; break; | |
case "9": choise = "Sagittarius"; break; | |
case "10": choise = "Capricorn"; break; | |
case "11": choise = "Aquarius"; break; | |
case "12": choise = "Pisces"; break; | |
default: | |
Console.WriteLine("Error"); | |
return; | |
} | |
string today = DateTime.Today.ToString("yyyy-MM-dd"); | |
string todayUrl = $"https://horoscope-app-api.vercel.app/api/v1/get-horoscope/daily?sign={choise}&day={today}"; | |
using (HttpClient client = new HttpClient()) | |
{ | |
try | |
{ | |
string todayResponse = await client.GetStringAsync(todayUrl); | |
Console.WriteLine($"\nГороскоп для {choise} на сегодня:"); | |
Console.WriteLine(todayResponse); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine("Ошибка запроса: " + ex.Message); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment