Wie kann ich variable Daten in verschiedenen Klassen/Hohlräumen transportieren? Ich bin irgendwie neu in C# und kann Sup
Posted: 21 May 2025, 11:57
Ich versuche herauszufinden, wie man das letzte Segment meines Codes in eine andere Leere transportiert (untere Void bis oberste Leere). Ich werde versuchen, die Antworten so schnell wie möglich zu beantworten. < /p>
Code: Select all
if (key == 'B')
{
BuyX (bstr, bstrCost, sp, 10);
}
public static void BuyX(double bstr, double bstrCost, double sp, double z)
{
double currentCost = 0;
double totalCost = 0;
double repeat = 0;
currentCost = bstrCost;
while (repeat < z - 1)
{
totalCost = totalCost + currentCost;
currentCost = (currentCost * (1.25 + (0.005 * (bstr - 1 + repeat))));
repeat = repeat + 1;
}
totalCost = totalCost + currentCost;
Console.WriteLine(totalCost);
if (sp >= totalCost)
{
//sp = sp - totalCost;
//bstr = bstr + z;
//bstrCost = currentCost;