в моем коде следующая проблема: у меня есть несколько операторов if, требующих ввода пользователя. И я хотел бы установить число (100), что если пользовательский ввод == нет, то х число вычитается из 100, но мне нужно это так сказать первый пользователь, чтобы сказать нет, (100-у) = а, а затем второй пользователь скажет нет, его значение вычтет ay скажем.
Счетчики используются для чего-то другого. Я вроде как новичок в C#, надеюсь, в этом есть смысл, вся помощь оценена.
namespace Ice_Cream
{
class Program
{
static void Main(string[] args)
{
int counter = 0;
int counter2 = 0;
int counter3 = 0;
int PercentageDisklikes = 100;
string[] Foods = { "Icecream" , "Coffee" , "Sweetpotato" };
string[] Dislike = { "5", "10", "3" };
Console.WriteLine(Foods[0]);
string Icecream = Console.ReadLine();
Console.WriteLine("Do you like Ice cream? " );
if (Icecream == "yes")
{
counter++;
Console.WriteLine("Amount of ppl that like Ice cream: " + counter);
}
if (Icecream == "no")
{
counter2++;
Console.WriteLine("Amount of ppl that don't like Ice cream " + counter2);
Console.WriteLine("Study shows 10% of people agree with you");
// Here i would like int PercentageDisklikes = 100 - 5 to then
//Console.WriteLine("Ovr satisfaction (= 100 -5)
}
else if (Icecream == "maybe")
{
counter2++;
counter3++;
Console.WriteLine("Amount of ppl that don't like Ice cream : " + counter2);
Console.WriteLine("Amount of ppl that maybe don't like Ice cream: " + counter3);
// Here i would like int PercentageDisklikes = 100 - 5 to then
//Console.WriteLine("Ovr satisfaction (= 100 -5)
}
Console.WriteLine(Foods[1]);
string Coffee = Console.ReadLine();
Console.WriteLine("Do you like Coffee? ");
if (Coffee == "yes")
{
counter++;
Console.WriteLine("Amount of ppl that like Coffee: " + counter);
}
if (Coffee == "no")
{
counter2++;
Console.WriteLine("Amount of ppl that don't like Coffee " + counter2);
Console.WriteLine("Study shows 10% of people agree with you");
// Here i would like int PercentageDisklikes = 95 - 5 to then (95 from previous result)
//Console.WriteLine("Ovr satisfaction (= 95 -5)
}
else if (Coffee== "maybe")
{
counter2++;
counter3++;
Console.WriteLine("Amount of ppl that don't like Coffee : " + counter2);
Console.WriteLine("Amount of ppl that maybe don't like Coffee : " + counter3);
// Here i would like int PercentageDisklikes = 95 - 5 to then
//Console.WriteLine("Ovr satisfaction" + PercentageDislikes (= 95 -5)
}