4
The variable in the last console.writeline is giving that has not been assigned being that it was in ifs, I wonder why.
string c, nome;
double s, sn;
Console.WriteLine("Escreva o nome:");
nome = Console.ReadLine();
Console.WriteLine("Escreva o salário:");
s = double.Parse(Console.ReadLine());
Console.WriteLine("Escreva a categoria:");
c = Console.ReadLine();
if (c == "a" || c == "c" || c == "f" || c == "h")
{
sn = s * 1.10;
}
else if (c == "b" || c == "d" || c == "e" || c == "i" || c == "j" || c == "t")
{
sn = s * 1.15;
}
else if (c == "k" || c == "r")
{
sn = s * 1.25;
}
else if (c == "l" || c == "m" || c == "n" || c == "o" || c == "p" || c == "q" || c == "s")
{
sn = s * 1.35;
}
else if (c == "u" || c == "v" || c == "x" || c == "y" || c == "w" || c == "z")
{
sn = s * 1.50;
}
else
{
Console.WriteLine("Categoria inválida!");
}
Console.WriteLine(" Nome: {0}\n Categoria: {1}\n Novo salário: R$ {2:0.00}", nome, c, sn);
Console.ReadKey();
The reply was posted by LINQ, but you tagged the Pagotti comment
– Leandro Angelo