1
I’m doing a simple quiz show with questions and answers, with punctuation. My problem is this: I made a function so that every time the answer is right, +1 will be added to the score variable.
public static int pontu1 { get; set; }
    public static int pont(int pontu1)
    {
        pontu1++;
        return pontu1;
    }
So apparently, it’s working, I’ve decided to create the "right answer" function, so every time the answer is right, this function will be called:
public static void rcerta()
    {
        Console.WriteLine("Resposta certa");
        pont(pontu1);
        System.Threading.Thread.Sleep(2000);
        Console.Clear();
    }
Problem is, I went to test the code, sent the question, put the right answer. Okay, the function ran normal, gave right answer, however, when I went to see how much was my score, with the following code (it sits inside a switch from a menu I made) :
case 2:
                    Console.WriteLine("Sua pontuação é: " + pontu1);
                    Console.WriteLine("Pressione ENTER para continuar....");
                    break;
The score appears as 0, even with the right answer. Can anyone help me? Follow the whole program and the class below.
Program:
class Program
{
    public static int pontu1 { get; set; }
    public static int pont(int pontu1)
    {
        pontu1++;
        return pontu1;
    }
    public static void rcerta()
    {
        Console.WriteLine("Resposta certa");
        pont(pontu1);
        System.Threading.Thread.Sleep(2000);
        Console.Clear();
    }
    public static void rerrada()
    {
        Console.WriteLine("Resposta errada");
        Console.Clear();
    }
    public static void resetar()
    {
        string r;
        Console.WriteLine("Sua pontuação atual é: " + pontu1);
        Console.WriteLine("Deseja reiniciar sua pontuação?      S  / N");
        r = Console.ReadLine();
        if (r == "S")
        {
            pontu1 = 0;
            Console.WriteLine("Pontuação reiniciada.");
            Console.WriteLine("Sua pontuação atual é: " + pontu1);
            Console.WriteLine("Pressione ENTER para voltar ao menu...");
        }
        else
        {
            Console.WriteLine("Pontuação mantida.");
            Console.WriteLine("Sua pontuação atual é: " + pontu1);
            Console.WriteLine("Pressione ENTER para voltar ao menu...");
        }
    }
    public static void QuizIncio()
    {
        int opcao;
        Console.WriteLine("Escolha um assunto!");
        Console.WriteLine("[ 1 ] teste");
        Console.WriteLine("[ 2 ] teste2");
        Console.WriteLine("-------------------------------------");
        Console.Write("Digite uma opção: ");
        opcao = Int32.Parse(Console.ReadLine());
        switch (opcao)
        {
            case 1:
                Class1.teste();
                break;
            case 2:
                break;
            default:
                break;
        }
        Console.ReadKey();
        Console.Clear();
    }
    static void Main(string[] args)
    {
        int opcao;
        do
        {
            Console.WriteLine("[ 1 ] Iniciar");
            Console.WriteLine("[ 2 ] Ver Pontuação");
            Console.WriteLine("[ 3 ] Resetar Pontuação");
            Console.WriteLine("[ 0 ] Sair do Programa");
            Console.WriteLine("-------------------------------------");
            Console.Write("Digite uma opção: ");
            opcao = Int32.Parse(Console.ReadLine());
            switch (opcao)
            {
                case 1:
                    Console.Clear();
                    QuizIncio();
                    break;
                case 2:
                    Console.WriteLine("Sua pontuação é: " + pontu1);
                    Console.WriteLine("Pressione ENTER para continuar....");
                    break;
                case 3:
                    Console.Clear();
                    resetar();
                    break;
                case 0:
                    break;
            }
            Console.ReadKey();
            Console.Clear();
        }
        while (opcao != 0); 
    }
}
Class:
class Class1 : Program
{
    public static void teste()
    {
        string r1, r2, r3, r4, r5;
        Console.WriteLine("Quanto é 2 + 2?");
        Console.WriteLine("a) 4");
        Console.WriteLine("b) 3");
        r1 = Console.ReadLine();
        if (r1 == "a")
        {
            rcerta();
        }
        else
        {
            rerrada();
        }
    }
}