Programming Language
Output is what is what is displayed on the screen when running a program(text, images, videos, etc.)
Properties control objects. They control the colour, text, size and more.
Variables are items that are stored in the RAM so that the program can refer to them and use them.
Input is what the user types into the program to get the output.
How To Create A Program
To create a windows forms application:
To create a console program:
How To Create Outpout
in your windows form application do the following:
drag and drop a label and a button onto your form
in the properties rename your label to lblOutput
between the braces type the following
lblOutput.Text = "text";
start the program and press the button to view the text
in your console program write the following:
Console
Console.WriteLine
Console.WriteLine("text");
Declaring and Initializing Variables
boolean(true/false)
Boolean blnVar;
blnVar = true;
integer(-3,-2,-1,0,1,2,3)
Int 32 intVar;
intVar = -47;
Floating Point(double, decimal number)
Double dblVar;
dblVar = 13.653;
String(words)
String strVar;
strVar = "text";
Getting Input
Console Input
Console.ReadLine();
Windows Form Input
int x;
int.TryParse(txtInput.Text, out x);
or
int x = (int)nudInput.Value;
or
double x;
double.TryParse(txtInput.Text, out x);
or
double x = (double)nudInput.Value;
Math
Adding and Subtracting
Int32 x = 2;
Int32 y = 1;
Int32 = adding;
adding = x + y;
Console.WriteLine(String.Concat(x.ToString(), "+", y.ToString(), "=", adding.ToString()));
Int32 subtracting;
subtracting = x - y;
Console.WriteLine(String.Concat(x.ToString(), "-", y.ToString(), "=", subtracting.ToString()));
Console.ReadKey();
Multiplying and Dividing
Double x = 5.65;
Double y = 7;
Double multiplying;
multiplying = x * y;
Console.WriteLine(String.Concat(x.ToSTring(), "*", y.ToString(), "=", multiplying.ToString()));
Double dividing;
dividing = x / y;
Console.WriteLine(String.Concat(x.ToString(), "/", y.ToString(), "=", dividing.ToString()));
Console.ReadKey;
Concatenating Strings
Concatenating strings connects words by using String.Concat()
String strType = "Chicken Noodle";
String strFood = "Soup";
Console.WriteLine(String.Concat(strType, " ", strFood));
Citations
McTavish, Ian. C#. Workbook. N.p., 1 Sept. 2014. Web. 29 Sept. 2014.
"Visual C# Resources." Visual C# Resources. N.p., n.d. Web. 01 Oct. 2014.