V
vinnie
this is my little code, the msg i get is:
a) Error 2 'dico.Program.Calcolo(decimal)': not all code paths return
a value C:\Documents and Settings\Robert\Desktop\prova VS8\dico\dico
\Program.cs 42 43 dico;
b) Error 1 A local variable named 'valueted' cannot be declared in
this scope because it would give a different meaning to 'valueted',
which is already used in a 'parent or current' scope to denote
something else C:\Documents and Settings\Robert\Desktop\prova VS8\dico
\dico\Program.cs 24 36 dico;
And this is the code:
namespace dico
{
public class Program
{
public static void Main(string[] args)
{
decimal value = 0;
decimal total = 0;
Insert(value);
Mostra(value);
Calcolo(total);
}
public static decimal Insert(decimal valueted)
{
Console.Write(" Please insert the umber to
evaluate ");
string val = Console.ReadLine();
decimal valueted = Convert.ToDecimal(val);
Console.WriteLine();
while (true)
{
if (valueted >=2)
{
return valueted;
}
Console.WriteLine(" Attenzione valore
minore di due, riprova...");
Console.WriteLine();
}
}
public static void Mostra(decimal valueted)
{
Console.WriteLine(" Il valore da te inserito
come numero di elemnti e': " +valueted);
}
public static decimal Calcolo(decimal valueted)
{
for (int i=10; i<=valueted; i--)
{
Console.WriteLine(" Insert the first
number to use: ");
decimal total;
total = valueted - 1;
Console.WriteLine(total);
}
}
}
}
all i was trying to do was to
a) ask for a number;
b) subtract 1 each time (100-1=99; 99-1=98;...)
c) show the result.
To say that i'm desperate doens't give my right mood now...
a) Error 2 'dico.Program.Calcolo(decimal)': not all code paths return
a value C:\Documents and Settings\Robert\Desktop\prova VS8\dico\dico
\Program.cs 42 43 dico;
b) Error 1 A local variable named 'valueted' cannot be declared in
this scope because it would give a different meaning to 'valueted',
which is already used in a 'parent or current' scope to denote
something else C:\Documents and Settings\Robert\Desktop\prova VS8\dico
\dico\Program.cs 24 36 dico;
And this is the code:
namespace dico
{
public class Program
{
public static void Main(string[] args)
{
decimal value = 0;
decimal total = 0;
Insert(value);
Mostra(value);
Calcolo(total);
}
public static decimal Insert(decimal valueted)
{
Console.Write(" Please insert the umber to
evaluate ");
string val = Console.ReadLine();
decimal valueted = Convert.ToDecimal(val);
Console.WriteLine();
while (true)
{
if (valueted >=2)
{
return valueted;
}
Console.WriteLine(" Attenzione valore
minore di due, riprova...");
Console.WriteLine();
}
}
public static void Mostra(decimal valueted)
{
Console.WriteLine(" Il valore da te inserito
come numero di elemnti e': " +valueted);
}
public static decimal Calcolo(decimal valueted)
{
for (int i=10; i<=valueted; i--)
{
Console.WriteLine(" Insert the first
number to use: ");
decimal total;
total = valueted - 1;
Console.WriteLine(total);
}
}
}
}
all i was trying to do was to
a) ask for a number;
b) subtract 1 each time (100-1=99; 99-1=98;...)
c) show the result.
To say that i'm desperate doens't give my right mood now...