Hello after long time I am writing an article. Today I learn you how to make program in C Sharp. So if you want to be programmer, you must read something about algorithms. And now we can start. Find and download Microsoft Visual Studio make new file C# Console Application. Now you can see this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
}
}
}
Click on Start and it opens an black window (it's CMD). That's too easy, right? It's a staunch tradition that the first program in a new language is called Hello world. It is a program which in any way the user displays "Hello world" or some similar text. Again I repeat that command will write the body of the method main. We will need two commands (NB. I use the term orders for simplification), one to display text and wait for others to press any key to program just ended.
To extract text folds
Console.WriteLine("Text");
And to wait with key:
Console.ReadKey();
Now it looks:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello world!");
Console.ReadKey();
}
}
}
If you click on start console window writes:
Hello world!
Press any key to continue...
So that was our first program. Next time I learn you how to programme a calculator in C#.
No comments:
Post a Comment