Воспроизведение сценария в C#?C#

Место общения программистов C#
Ответить
Anonymous
 Воспроизведение сценария в C#?

Сообщение Anonymous »

Совершенно новый C# Coder Здесь я сделал простую игру «казино» (вероятно, с ужасным синтаксисом).
Я пытаюсь играть в этот сценарий снова и снова, отслеживая переменную «деньги» вместо сценария, просто заканчивающегося, когда играет одна игра. Есть советы? < /P>

Код: Выделить всё

// See https://aka.ms/new-console-template for more information
using System;
using Microsoft.VisualBasic;

Console.WriteLine("  ___         _          ");
Console.WriteLine(" / __|__ _ __(_)_ _  ___ ");
Console.WriteLine("| (__/ _` (_-< | ' |/ _ | ");
Console.WriteLine("|_______,_/__/_|_||_|___/");

Random rnd = new Random();
int money = 10; // starts the user with 10 dollars
int random = rnd.Next(1, 4); // choosing random ass number for the random variable

Console.WriteLine("Welcome");
Console.WriteLine("Please enter age");

string input1 = Console.ReadLine();
int ass = Int32.Parse(input1); // making "ass" equal to "input1"
if (ass >= 18)
{
Console.WriteLine("Please choose an integer 1-3 ");
string input2 = Console.ReadLine();

Console.WriteLine("You have " + money + " dollars."); // stating the current balance
Console.WriteLine("How much would you like to bet?");

string inputmoney = Console.ReadLine();
int bet = Int32.Parse(inputmoney); // making the string "input" equal to the int variable "shit"

Console.WriteLine("Spinning");

int shit = Int32.Parse(input2); // making the string "input" equal to the int variable "shit"

if (shit == random) // if the user's guess was correct
{
int sum = (bet * 3) + money; // generates user's current sum
Console.WriteLine("You Win!");
Console.WriteLine("Your current balance is " + sum); // displays user's current sum
Console.Write("The integer was " + shit);
}
else // if the user's guess was incorrect
{
int sum = money - bet; // generates user's current sum
Console.WriteLine("You Lose");
Console.WriteLine("Your current balance is " + sum); // displays user's current sum
Console.Write("The integer was " + random);
}
}
else
Console.WriteLine("Please come back when you are 18.");
Я пытался просто копировать и вставать на это снова и снова, но это грех против Бога

Подробнее здесь: https://stackoverflow.com/questions/794 ... cript-in-c
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»