Getting Started with C # basics--About C # background and variable correlation

Source: Internet
Author: User

Before we formally explore the mysteries of C #, we now turn to the question of learning methods. The person always is to oneself struggle diligently to get the thing, cherish. So is learning. Only when they encounter problems, find ways to solve the problem, will be unforgettable. The articles I wrote, as well as the teachers ' professors, and even all the self-taught videos, were just a secondary function. What you get in there is just a piecemeal knowledge point. For a long time, anyone can remember. This is just a process of remembering. The way that we can learn to solve problems is what we really want to learn. It is important to remember that we are not learning knowledge, but the ability to learn solutions. But to improve their ability to solve problems, we must learn the relevant knowledge well, in the final analysis, the two are inseparable.

Well, gossip doesn't say much, start to get to the point today. First C # Beginners are more fortunate than Java beginners. Your learning journey is a simple and easy process, especially easy to get started with. But the course of Java learners is the opposite, the first to configure various types of environment variables, particularly complex, and precisely because of this, many Java beginners are excluded from the industry. And as a beginner of our C # We have absolutely no need to think about the problems that this brings. TSE can baizhanbudai the other side. Let's take a look at the course of C #, CSharp, an object-oriented programming language designed by Microsoft for the NET Framework, released in June 2000. The C # language inherits the excellent features of many programming languages prevalent in the computer community, such as Java, C + +, and so on.

There are also many people who call C #. NET. So what's the connection between the two? In fact, C # is a programming language, and. NET is a programming platform. The two actually do not have to compare the meaning. NET platform can be programmed in many languages, such as C + +, F #, and so on. NET platform is more used in the C # language. So people often take. NET and C # are considered to be the same. Because C # is a compiled language. Pass. NET can compile the C # language into an intermediate language. Such words run in. Language can be called in any language on the net platform. Which means we're in. NET platform, you can use C # to fully invoke functions written in C + + code.

The variable constants are now explained below. What is a variable? The literal meaning of understanding, that is, the amount of change. Right! The same is true in C #. The amount of change is represented by a variable. For example, we do a student score query system. We check their grades by a student's number. And here the number of the study is a change in quantity. We can use variables to store them. So how exactly should we define a variable? int studentnum; So we define a variable of type int. But what about this int? Take a look at the table below and I think you'll find something smart.

Signed integral type: Sbyte,short,int,long

Unsigned integral type: Byte,ushort,uint,ulong

Unicode characters: Char

IEEE floating-point type: float,double

High Precision decimal: decimal

Boolean type: BOOL

In fact, they correspond to a type of variable. For example, if we define a variable that stores an integer type, we can use Int. And we're going to define a decimal variable to use float. Specific variable types are described in the table above.

We must learn to apply our knowledge. Now that we know what the variables are, let's use them for a specific purpose. We achieve the two number of the and. We open vs2013 (other versions are also available, I use 2013 here). Click File---Select New-select project in the upper-left corner. Here we create a new console project. Select the console application and start with a good name below. Click OK. We find the static void Main (string[] args) and write the code in the curly braces below him. We can write it like this.

int a = 10; A variable of type int with variable name A is defined, which can only store integers. The equals sign is the meaning of the assignment. That is, assign a value of 10 to the back. After this statement a is equal to 10.
int B = 20; Defines a variable of type int with the variable named a, assigning him a value of 20
int C = a + B; A variable of type int named A is defined, and then the value of A+b is given to C. Now the value stored in C is a+b, which is 30.

is not very simple. Have you learned it. But now there's a problem. The result of this C can be obtained by logical analysis. But how should we show it to the user? The console has such a syntax Console.WriteLine (c); So we'll show the value of C on the console. But there was a problem, and the console program flashed through. It's so strange, we haven't seen it yet. So there's the following line of command Console.readkey (); In such a run, he will wait until we have the keyboard pressed to close the console.

Since all have learned two books to sum, the back of the poor seek to take their own practice, I hope everyone as soon as possible familiar with the grammar.

Getting Started with C # basics--About C # background and variable correlation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.