TOPIC

Está dando erro alguém pode me dizer o que é?

João Neto asked 3 months ago

//Codigo dos lanches double HT = 4.00; double XS = 4.50; double XB = 5.00; double T = 2.00; double R = 1.50;

       int Cod, Quant;
        string[] tudo = Console.ReadLine().Split(' '); Cod = int.Parse(tudo[0]); Quant = int.Parse(tudo[1]);

        double C = 0; 

            if (Cod == 1)
        {
            C = HT * Quant;
            Console.WriteLine("TOTAL: R$ {0}", C.ToString("F2"));
        }
        else if (Cod == 2)
        {
            C = XS * Quant;
            Console.WriteLine("TOTAL: R$ {0}", C.ToString("F2"));
        }
        else if (Cod == 3) 
        {          
            C = XB * Quant;
            Console.WriteLine("TOTAL: R$ {0}", C.ToString("F2"));
        }
        else if (Cod == 4)
        {
            C = T * Quant;
            Console.WriteLine("TOTAL: R$ {0}", C.ToString("F2"));
        }
        else if (Cod == 5)
        {
            C = R * Quant;
            Console.WriteLine("TOTAL: R$ {0}", C.ToString("F2"));
        }

Remember not post solutions. Your post may be reviewed by our moderators.

  • Raphael replied 3 months ago

    Troque:

              Console.WriteLine("TOTAL: R$ {0}", C.ToString("F2"));

    Por:

              Console.WriteLine("Total: R$ {0}", C.ToString("F2"));

    Em todos os Console.WriteLine...