<snip>
I am debating whether to help you with your homework problems (I thought you
said you were familiar with programming? This is basic first year
functional programming class.)
The error messages are quite clear.
a) Your function Insert isn't returning a value, but you declared it as
returning a decimal.
b) Your function Insert has declared a local variable and parameter of the
same name.
You need to decide whether you want the valuted parameter to be local to the
function and returned, or if you want it to be passed as a ref parameter to
the function.
Your loop in calcolo is definitely not going to work as expected.
Your function calcolo is going to run into the same problem with not
returning a value.
Based on your requirements, you are calling Insert, Calcolo and Mostra in
the wrong order.

Signature
Doug Semler, MCPD
a.a. #705, BAAWA. EAC Guardian of the Horn of the IPU (pbuhh).
The answer is 42; DNRC o-
Gur Hfrarg unf orpbzr fb shyy bs penc gurfr qnlf, abbar rira
erpbtavmrf fvzcyr guvatf yvxr ebg13 nalzber. Fnq, vfa'g vg?
Ben Voigt [C++ MVP] - 04 Sep 2007 23:17 GMT
> <snip>
>
[quoted text clipped - 5 lines]
> a) Your function Insert isn't returning a value, but you declared it as
> returning a decimal.
To be fair, this one isn't true. Insert has only one exit point and it does
return a value.
> b) Your function Insert has declared a local variable and parameter of the
> same name.
[quoted text clipped - 8 lines]
> Based on your requirements, you are calling Insert, Calcolo and Mostra in
> the wrong order.
Jon Skeet [C# MVP] - 04 Sep 2007 23:28 GMT
> > The error messages are quite clear.
> > a) Your function Insert isn't returning a value, but you declared it as
> > returning a decimal.
>
> To be fair, this one isn't true. Insert has only one exit point and it does
> return a value.
Indeed - Doug just got the wrong method. As per the compiler error
message, it's the Calcolo method which doesn't return a value.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Doug Semler - 05 Sep 2007 03:55 GMT
>> <snip>
>>
[quoted text clipped - 8 lines]
> To be fair, this one isn't true. Insert has only one exit point and it
> does return a value.
Ach, Gott. I wasn't paying attention and didn't read the error message.
The functionality was so convoluted....

Signature
Doug Semler, MCPD
a.a. #705, BAAWA. EAC Guardian of the Horn of the IPU (pbuhh).
The answer is 42; DNRC o-
Gur Hfrarg unf orpbzr fb shyy bs penc gurfr qnlf, abbar rira
erpbtavmrf fvzcyr guvatf yvxr ebg13 nalzber. Fnq, vfa'g vg?
> 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;
And it's absolutely right. You've declared that your method will return
a result, but you're not returning anything.
> 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;
You've got a parameter called valueted, but you're trying to declare a
local variable with the same name. You can't do that.
While we're at it, look at this loop:
for (int i=10; i<=valueted; i--)
Assuming valueted starts off as 12, that's going to last a very long
time:
i=10 - is i <= 12? Yes. i--...
i=9 - is i <= 12? Yes. i--...
i=8 - is i <= 12? Yes. i--...
etc

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too