Ein Skript in C#wiederholen?C#

Ein Treffpunkt für C#-Programmierer
Anonymous
 Ein Skript in C#wiederholen?

Post by Anonymous »

brandneues C# -Codierer hier habe ich ein einfaches "Casino" -Spiel gemacht (wahrscheinlich mit schrecklicher Syntax). Das Drehbuch endet gerade, wenn ein Spiel gespielt wird. Irgendwelche Tipps? < /P>

Code: Select all

// 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.");
Ich habe versucht, dies immer und immer wieder zu kopieren und zu fügen, aber das ist eine Sünde gegen Gott

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post