Skip to content

Commit fe57365

Browse files
Create Program.cs
1 parent 1860e58 commit fe57365

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

source-code-EXPLAINED/Program.cs

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
//auto-generated code start
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using System.Threading;//declared for Thread.Sleep(1000); (line 42)
8+
9+
namespace Indietro
10+
{
11+
internal class Program
12+
{
13+
static void Main(string[] args)
14+
{
15+
//auto-generated code end
16+
Console.Clear(); //clears the console from texts
17+
string titolo = @"
18+
19+
████████╗░█████╗░██████╗░███╗░░██╗░█████╗░  ██╗███╗░░██╗██████╗░██╗███████╗████████╗██████╗░░█████╗░
20+
╚══██╔══╝██╔══██╗██╔══██╗████╗░██║██╔══██╗  ██║████╗░██║██╔══██╗██║██╔════╝╚══██╔══╝██╔══██╗██╔══██╗
21+
░░░██║░░░██║░░██║██████╔╝██╔██╗██║███████║  ██║██╔██╗██║██║░░██║██║█████╗░░░░░██║░░░██████╔╝██║░░██║
22+
░░░██║░░░██║░░██║██╔══██╗██║╚████║██╔══██║  ██║██║╚████║██║░░██║██║██╔══╝░░░░░██║░░░██╔══██╗██║░░██║
23+
░░░██║░░░╚█████╔╝██║░░██║██║░╚███║██║░░██║  ██║██║░╚███║██████╔╝██║███████╗░░░██║░░░██║░░██║╚█████╔╝
24+
░░░╚═╝░░░░╚════╝░╚═╝░░╚═╝╚═╝░░╚══╝╚═╝░░╚═╝  ╚═╝╚═╝░░╚══╝╚═════╝░╚═╝╚══════╝░░░╚═╝░░░╚═╝░░╚═╝░╚════╝░
25+
26+
- Crediti: Calabrese#0001 -
27+
- Github: https://github.com/Nick06888/ -
28+
29+
";
30+
//Console.WriteLine and Console.Write are the same thing but with the first "command" uses the whole line
31+
Console.WriteLine(titolo); //prints on the console the string titolo
32+
Console.Title = "Calabrese#0001 - Pronto"; //changes console's title
33+
Console.BackgroundColor = ConsoleColor.DarkGreen; //changes font color
34+
Console.Write("Numero >"); //prints on the screen "Numero >" (translated into english: Number >)
35+
Console.BackgroundColor = ConsoleColor.Black; //resets font color
36+
37+
Console.Write(" "); //prints space on the console for the input
38+
long a = Convert.ToInt64(Console.ReadLine()); //listens for input, long (integer) "a" will become the number you'll type
39+
Console.Clear(); //clears the console from texts
40+
Console.BackgroundColor = ConsoleColor.DarkGreen; //changes font color
41+
Console.WriteLine("Caricamento..."); //prints "Caricamento..." on the console (translated in english: Loading...)
42+
Console.BackgroundColor = ConsoleColor.Black; //resets font color
43+
Thread.Sleep(1000); //took from System.Threading declared at the top of the code, it makes the program wait 1000 ms (1s) making the loading... effect
44+
Console.Clear(); //clears the console from texts
45+
if (a < 0 || a == 0) //this boolean expression (it means that can return True [happened] or False [Didn't happen]) checks if the number you typed is negative or equal to zero
46+
{
47+
Console.BackgroundColor = ConsoleColor.DarkRed; //changes font color
48+
Console.Write("Coglione il numero deve essere positivo e diverso da zero!");//prints on the console an italian expression to say "you did something wrong" because we don't wanna that the number we typed go under 0
49+
Console.ReadKey();//waits for user key (enter, space...)
50+
return;//it stops the program process
51+
}
52+
Console.BackgroundColor = ConsoleColor.DarkCyan; //changes font color
53+
Console.WriteLine(a);//writes the number you typed
54+
Console.BackgroundColor = ConsoleColor.Black; //resets font color
55+
// - THE MOST IMPORTANT PART IN THE CODE -
56+
// --------------------------------------------------
57+
//for cycle which prints the number backwards until 0:
58+
// 1) We declare the long b which is a - 1, suppose we typed the number 10, b will be 10 - 1
59+
// 2) We declare when the program stops, in this case it will stop when b will be minor or equal to a (never), so we created an infinite loop
60+
// 3) We declare what the program must do when it's in the cycle, in this case every time the cycle restarts it will subtract 1 to long b
61+
for (long b = a - 1; b <= a; b--)
62+
{
63+
64+
if (b == 0)
65+
{
66+
Console.BackgroundColor = ConsoleColor.Red; //changes font color
67+
Console.Write(String.Format(b + " <- Fine")); //when b becomes 0 will print 0 <- Fine (translated in english: 0 <- End)
68+
Console.Title = "Calabrese#0001 - Completato";//changes the console title
69+
Console.BackgroundColor = ConsoleColor.Black; //resets font color
70+
Console.Write("\nGrazie per aver usato il mio programma!"); // "Press enter to continue"
71+
Console.ReadKey();//waits for user key (enter, space...)
72+
return;//if b is equal to 0 it stops the program process
73+
}
74+
Console.WriteLine(b);//prints the value of
75+
Console.Title = String.Format("Calabrese#0001 - "+b);//changes the console title with the value of b
76+
}
77+
// --------------------------------------------------
78+
79+
80+
}
81+
}
82+
}
83+
//PS: Sorry for my bad english
84+
//-----------------------------------------------------------------------------------------------------//
85+
86+
//░█▀▀█ ▒█▄░▒█   ▀█▀ ▀▀█▀▀ ░█▀▀█ ▒█░░░ ▀█▀ ░█▀▀█ ▒█▄░▒█   ▒█▀▀█ ▒█▀▀█ ▒█▀▀▀█ ▒█▀▀█ ▒█▀▀█ ░█▀▀█ ▒█▀▄▀█
87+
//▒█▄▄█ ▒█▒█▒█   ▒█░ ░▒█░░ ▒█▄▄█ ▒█░░░ ▒█░ ▒█▄▄█ ▒█▒█▒█   ▒█▄▄█ ▒█▄▄▀ ▒█░░▒█ ▒█░▄▄ ▒█▄▄▀ ▒█▄▄█ ▒█▒█▒█
88+
//▒█░▒█ ▒█░░▀█   ▄█▄ ░▒█░░ ▒█░▒█ ▒█▄▄█ ▄█▄ ▒█░▒█ ▒█░░▀█   ▒█░░░ ▒█░▒█ ▒█▄▄▄█ ▒█▄▄█ ▒█░▒█ ▒█░▒█ ▒█░░▒█
89+
90+
//-----------------------------------------------------------------------------------------------------//

0 commit comments

Comments
 (0)