V
vinnie
I'm a self learner, and i'm trying to figure out how this code should
work. What is not clear to me, is why the function InsertNumber is
called 3 times: wasn;t easier to call it just once and put all
together?
There is a call to that function at line 8, 13, 17
1 namespace riprova
2 {
3 public class Program
4 {
5 public static void Main(string[] args)
6 {
7 decimal number = 0;
8 InsertNumber(ref number);
9 Console.Write(" Number to
be considerd: " + number);
10 Console.Read();
11 Show(number);
12 }
13 public static void
InsertNumber(ref decimal number)
14 {
15 number = InsertNumber("
Value ");
16 }
17 public static decimal
InsertNumber(string answer)
18 {
19 Console.WriteLine(" Insert
the value of " + answer);
20 string accept =
Console.ReadLine();
21 decimal value =
Convert.ToDecimal(accept);
22 return value;
23 }
24 public static void
Show(decimal number)
25 {
26 for (int amount = 0;
amount >= number; amount++)
27 {
28 number = (number + 1);
29
Console.WriteLine(number);
30 Console.ReadLine();
31 Console.Read();
32 }
33 }
34 }
35 }
work. What is not clear to me, is why the function InsertNumber is
called 3 times: wasn;t easier to call it just once and put all
together?
There is a call to that function at line 8, 13, 17
1 namespace riprova
2 {
3 public class Program
4 {
5 public static void Main(string[] args)
6 {
7 decimal number = 0;
8 InsertNumber(ref number);
9 Console.Write(" Number to
be considerd: " + number);
10 Console.Read();
11 Show(number);
12 }
13 public static void
InsertNumber(ref decimal number)
14 {
15 number = InsertNumber("
Value ");
16 }
17 public static decimal
InsertNumber(string answer)
18 {
19 Console.WriteLine(" Insert
the value of " + answer);
20 string accept =
Console.ReadLine();
21 decimal value =
Convert.ToDecimal(accept);
22 return value;
23 }
24 public static void
Show(decimal number)
25 {
26 for (int amount = 0;
amount >= number; amount++)
27 {
28 number = (number + 1);
29
Console.WriteLine(number);
30 Console.ReadLine();
31 Console.Read();
32 }
33 }
34 }
35 }