Loading...

Във форума е въведено ограничение, което позволява на потребителите единствено да разглеждат публикуваните въпроси.

Iv_Konov avatar Iv_Konov 383 Точки
Best Answer

Здравей,

готово - 100/100.

 

=======

 string command = Console.ReadLine(); // добавих вход за End of game

            while (command != "End of game")
            {
                int firstPlayerCard = int.Parse(command); // добавих вход за End of game
                int secondPlayerCard = int.Parse(Console.ReadLine());
                if (firstPlayerCard > secondPlayerCard)
                {
                    firstPlayerPoints += firstPlayerCard - secondPlayerCard; // firstPlayerPoints = firstPlayerCard - secondPlayerCard
                }
                else if (secondPlayerCard > firstPlayerCard)
                {
                    secondPlayerPoints += secondPlayerCard - firstPlayerCard;
                }
                else if (firstPlayerCard == secondPlayerCard)
                {
                    NumberWars = true;
                    firstPlayerCard = int.Parse(Console.ReadLine());
                    secondPlayerCard = int.Parse(Console.ReadLine());
                    if (firstPlayerCard > secondPlayerCard)
                    {
                        //firstPlayerPoints = firstPlayerCard - secondPlayerCard;  // тук не се сумира разликата в точките - просто се печели играта с точките до момента!
                        numberWarsWinner = firstPlayerName;
                        numberWarsWinnerPoints = firstPlayerPoints;
                        break;
                    }
                    else if (secondPlayerCard > firstPlayerCard)
                    {
                        //secondPlayerPoints = secondPlayerCard - firstPlayerCard; // тук не се сумира разликата в точките - просто се печели играта с точките до момента!
                        numberWarsWinner = SecondPlayerName;
                        numberWarsWinnerPoints = secondPlayerPoints;
                        break;
                    }
                }
                command = Console.ReadLine(); //firstPlayerCard = int.Parse(Console.ReadLine()) // добавих вход за End of game
                //secondPlayerCard = int.Parse(Console.ReadLine());
            }

=======

 

Поздрави,

Иван

1
09/04/2019 21:13:20
whitez avatar whitez 6 Точки

Благодаря !

1
Rocio58 avatar Rocio58 -2 Точки

I am glad to read this article. [url=https://www.google.com]google[/url]

-1
Rajaghere avatar Rajaghere -1 Точки

Get the Netflix Apk, Premium Cracked Version, for Android and IOS from our website. Watch Unlimited Movies/Shows in 4k for free.

-1
Borislav_Vulkov avatar Borislav_Vulkov 54 Точки

Здравейте и от мен,
ето едно нестандартно решение. Гледайки количеството код не мисля, че е по-удачния начин за рашаване на задачата но ми беше интерсно да го опитам.
Накрадко използвам безкраен While цикъл, който го прекъсвам при възникването на команди "End of game" или "Number wars". Решението използва и два метода. Първия "Winner" определя името на победителя от всяко раздаване или рвъща "Number wars" ако точките са еднакви. Втория метод "CalculatePoints" изчислява точките които трябва да бъдат добавени към точките на победителя при разглежданото раздаване. 

=========

using System;

namespace NumberWars
{
    class NumberWars
    {
        static void Main()
        {
            string firstPlayer = Console.ReadLine();
            string secondPlayer = Console.ReadLine();

            int firstPlayerPoints = 0;
            int secondPlayerPoints = 0;

            int firstPoints = 0;
            int secondPoints = 0;

            string comand1 = string.Empty;
            string comand2 = string.Empty;
            string winner = string.Empty;

            while (true)
            {
                comand1 = Console.ReadLine();
                if (comand1 == "End of game")
                {
                    break;
                }
                else
                {
                    firstPoints = int.Parse(comand1);
                }

                comand2 = Console.ReadLine();
                if (comand2 == "End of game")
                {
                    break;
                }
                else
                {
                    secondPoints = int.Parse(comand2);
                }

                winner = Winner(firstPlayer, secondPlayer, firstPoints, secondPoints);

                if (winner == firstPlayer)
                {
                    firstPlayerPoints += CalculatePoints(firstPoints, secondPoints);
                }
                else if (winner == secondPlayer)
                {
                    secondPlayerPoints += CalculatePoints(firstPoints, secondPoints);
                }
                else
                {
                    firstPoints = int.Parse(Console.ReadLine());
                    secondPoints = int.Parse(Console.ReadLine());
                    winner = Winner(firstPlayer, secondPlayer, firstPoints, secondPoints);
                    Console.WriteLine("Number wars!");
                    if (winner == firstPlayer)
                    {
                        Console.WriteLine("{0} is winner with {1} points", firstPlayer, firstPlayerPoints);
                    }
                    else
                    {
                        Console.WriteLine("{0} is winner with {1} points", secondPlayer, secondPlayerPoints);
                    }
                    break;
                }
            }

            if (comand1 == "End of game" || comand2 == "End of game")
            {
                Console.WriteLine("{0} has {1} points", firstPlayer, firstPlayerPoints);
                Console.WriteLine("{0} has {1} points", secondPlayer, secondPlayerPoints);
            }
        }

        static string Winner(string firstPlayer, string secondPlayer, int firstPoints, int secondPoints)
        {
            if (firstPoints > secondPoints)
            {
                return firstPlayer;
            }
            else if (secondPoints > firstPoints)
            {
                return secondPlayer;
            }
            else
            {
                return "Number wars";
            }
        }

        static int CalculatePoints(int firstPoints, int secondPoints)
        {
            int Calculate = firstPoints - secondPoints;
            if (Calculate < 0)
            {
                Calculate *= -1;
            }
            return Calculate;
        }
    }
}
 

1
Laus1986 avatar Laus1986 9 Точки

I liked most of the games which gives the opertunity of making the money in simple way.But earning money from the casino games is not so easy task which can help anyone to earn the money through the trading in casino games with the best https://icasinoreviews.info/bank-transfer-casino-nz/ site steps which most of the people follow for making more money.

-1
krum_43 avatar krum_43 750 Точки

Gambling is a vice.

0
Fednado avatar Fednado 1 Точки

С малък принос имам блог, който е отзивчив и забавен при програмиране за облекчаване на стреса: https://techbigs.com

-1
alberttynzov avatar alberttynzov 0 Точки

Hello, did you know that canabis can give butter? Canabis oil treatment has become popular today! Medicine is always one step ahead, and according to this, doctors say that this oil can be added to food and treats many diseases! It also helps with sleep disorders and insomnia! On this site https://cbddiagnosis.com talk about how useful this oil can be! Are you afraid to try this oil? Today I’ll go and buy it, I want to try how it works!

-1
Akinzccm avatar Akinzccm -1 Точки

I checked the website and it looks nice and responsive. I also wish I could get a blog design like this site.  Any contributions?

-1
ebyfezol avatar ebyfezol 4 Точки

I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work…

Best Regards,

office.com/setup 

www.office.com/setup OR office.com/setup

-1
barcel44 avatar barcel44 -2 Точки

Download Hotstar Mod APK latest version Free for Android and watch your favorite tv shows and movies all in one place for free! Excited to and  Watch Live TV, Crickets, Episodes on Premium Services without any Ads for Free. https://www.techsmarti.com/hotstar-mod-apk/

-1
29/04/2020 22:44:13
JackD avatar JackD -2 Точки

Thank you so much for such a well-written article. It’s full of insightful information. Your point of view is the best among many without fail. For certain, It is one of the best blogs in my opinion. Epayitonline and 9anime

-1
krum_43 avatar krum_43 750 Точки

Здравей колега,

Ето едно кратко решение и от мен(50/100)

https://pastebin.com/rj0TtiMh

Не знам защо някои от тестовете гърмят с Runtime error.

0
30/04/2020 11:22:36
aimglo avatar aimglo -3 Точки

FIFA 21 PPSSPP ISO File Download With PS4 Camera English ... FIFA 2021 is the latest game from the series of FIFA games developed by EA Sports. ... FIFA 2021 is not yet officially released so this is the modified version.

-1
aimglo avatar aimglo -3 Точки

Subway Surfers Online Read complete write up on Subway Surfers Online And Subway Surfers Unblocked, also enjoy your favourite arcade game online with its latest features on Subway Surfers Online and Unblocked You can now play your favourite Arcade game Subway Surfers online There is a piece of wonderful news for all Subway Surfers fan,
 

-1
aimglo avatar aimglo -3 Точки

DareTechy
number one Bitcoin Vendor in Nigeria, always check out Early Pregnancy Sign for your pregnancy sign and treatment in other to stay healthy, Get the latest and trending facts on InstaFactSite Fastzipmusic is the right spot to get Latest Music and Videos update.

Be it Afro Pop, Hip Hop, Afro beats, Comedies, and many more.

We are committed to promoting music and artists who have made good songs and music around the world

-1
tayyabiqbal929 avatar tayyabiqbal929 -2 Точки

number one Bitcoin Vendor in Nigeria, always check out for your pregnancy sign and treatment in other to stay healthy, Get the App and trending facts on is the right spot to get Latest Music and Videos update.

-1
19/09/2020 07:52:19
krum_43 avatar krum_43 750 Точки

Така и не разбрах защо сетваш точките на двамата играчи на 2.Освен това като е писал и Иван при равни карти не се начисляват точки.

0
GBWhatsapp avatar GBWhatsapp 5 Точки

Thanks for the information that you share with us, i really like you r content about this GB WhatsApp

-1
aimglo avatar aimglo -3 Точки

Features Of PES 2021 PPSSPP ISO File

 

  • PES 2021 ISO PPSSPP is completely an offline game.
  • It has full English commentary.
  • The game has so many languages but it is set to default language in English.
  • It is an updated version if PES 2020 ppsspp.
  • It contains players star rating and real life data.
  • It contains each club latest transfer, new kit and new formation.
  • The game graphics have been updated, see more at graphics review section.
  • The game has real life commentary, real life player celebration, each player emotions and celebrations.
  • Team Kits Updated to 2020 Season, Updated Team Logos like Juventus, Smooth Gameplay
  • Portrays players attitudes – Ronaldo FreeKick Posture, Messi Balancing,
  • Take advantage of the new seasonal matches, La Liga, Bundesliga, Barclays Premier League, League 1, Brazilian League, Indonesia League, and Cup.
  • New UEFA League UI, World Cup, International Friendlings, Exhibition Match, New Balls.

 

PES 2021 PPSSPP Graphics Review

-1
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.