theralsei
theralsei
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
got it! thanks!
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
By the way, I didn’t understand how Pizza turned into x, and why it’s x at all.
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
That's really interesting. Thank you!
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
Could you explain how these lines work?
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
Oh well, I take it that's pretty effective.
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
I have not met var. I understand that it can store data of any type?
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
But I'll think you understood me
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
I hate the translator, lol. I mean I want to make that I can't but pizza that doesn't exist
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
I need to make sure that I can't buy pizza that doesn't exist.
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
Yeah
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
case 1:
Console.WriteLine("Pizza name: ");
userPizzaInput = Console.ReadLine();
if(userPizzaInput != food.Name)
break;
case 1:
Console.WriteLine("Pizza name: ");
userPizzaInput = Console.ReadLine();
if(userPizzaInput != food.Name)
break;
Here another problem come. I have the same code, I just added a new string parameter called name. Since I have a pizzeria, you have to buy pizza in a pizzeria, so I wanted to make such a mechanic. But just by calling food in the condition, I will not be able to get "Name" from it. How can i do this?
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
I'm just a beginner in C#, and I didn't even think about a solution like that. catshrug Anyways, thank you!
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
Something like that?
string[] pizza = { "Pepperoni - 70" ...};
string[] pizza = { "Pepperoni - 70" ...};
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
Thank you for your help!
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
I came to a working way. Is it must be like
int[] foodPrices = { 70, 60, 55, 30, 80, 130 };
int[] foodAmount = { 5, 10, 10, 7, 12, 15 };

Console.WriteLine("Pizzeria!");
Console.SetCursorPosition(0, 5);
Console.WriteLine("Prices:");
for (int i = 0; i < foodPrices.Length; i++)
{
Console.WriteLine($"\nPizza {i+1} cost {foodPrices[i]}." );
Console.WriteLine($"Pizza {i+1} left {foodAmount[i]}");
}
int[] foodPrices = { 70, 60, 55, 30, 80, 130 };
int[] foodAmount = { 5, 10, 10, 7, 12, 15 };

Console.WriteLine("Pizzeria!");
Console.SetCursorPosition(0, 5);
Console.WriteLine("Prices:");
for (int i = 0; i < foodPrices.Length; i++)
{
Console.WriteLine($"\nPizza {i+1} cost {foodPrices[i]}." );
Console.WriteLine($"Pizza {i+1} left {foodAmount[i]}");
}
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
I'll think about it
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
how exactly can i do this in one loop?
60 replies
CC#
Created by theralsei on 5/27/2023 in #help
"FOR"
It turns out I need to make them not nested?
60 replies