Mister0dd
Mister0dd
CC#
Created by Mister0dd on 1/19/2023 in #help
Need help for code to detect last number
Im new to c# and still learning and couldnt find anything useful online and I really need some help Class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CavalosTrabalho
{
public static class Dias
{
public static int dia = 0;

public static int nextDay()
{
dia = dia + 1;
return dia;
}

public static string dailyEvent(Cavalo cavalo)
{
Random rnd = new Random();
int random = rnd.Next(1, 3);

switch (random)
{
case 1:
cavalo.Velocidade = cavalo.Velocidade + 2;
return "O cavalo sente-se energético e começou a correr sozinho na pista de treino. +2 de Velocidade!";

case 2:
Status Status = Status.doente;
return "O cavalo adoeceu.";

default:
return "Nothing happened";
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CavalosTrabalho
{
public static class Dias
{
public static int dia = 0;

public static int nextDay()
{
dia = dia + 1;
return dia;
}

public static string dailyEvent(Cavalo cavalo)
{
Random rnd = new Random();
int random = rnd.Next(1, 3);

switch (random)
{
case 1:
cavalo.Velocidade = cavalo.Velocidade + 2;
return "O cavalo sente-se energético e começou a correr sozinho na pista de treino. +2 de Velocidade!";

case 2:
Status Status = Status.doente;
return "O cavalo adoeceu.";

default:
return "Nothing happened";
}
}
}
}
Program:
if (Dias.dia % (5))
{
Console.WriteLine(Torneio.race(Player1.Cavalo, Player1));
Console.ReadKey();
}
if (Dias.dia % (5))
{
Console.WriteLine(Torneio.race(Player1.Cavalo, Player1));
Console.ReadKey();
}
I want that, whenever the "dia" (day) last digit is 5, the method "Torneio" gets called. Quick help would be appreciated :) (Any questions about my code, will be whiling to answer and show more details if needed)
5 replies