|
You last visited: Today at 21:43
Advertisement
[Tut]Follow Along tutorial (C#)
Discussion on [Tut]Follow Along tutorial (C#) within the CO2 Programming forum part of the Conquer Online 2 category.
04/30/2012, 06:31
|
#1
|
elite*gold: 20
Join Date: Dec 2006
Posts: 945
Received Thanks: 175
|
[Tut]Follow Along tutorial (C#)
What's up guys,
So basically what this is going to be is a thread that will be updated everyday. With new lessons, new activity's and new quiz's. Starting from the extreme basics up to the more advanced stuff.
I have decided for myself to step away from the conquer point of C# and focus on the language itself. This means i have to start from the very basics (Variables,if - else statements, etc etc)
What i am going to do is grasp a concept throughout the day and post information about that general topic. These different sections will be in depth and if need be i can post videos.
*NOTE* At first somethings are going to be completely easy seeing as how i am just familiarizing myself with it. I also understand that some people are not familiarizing themselves and i will take that into account.
Some lessons will be posted everyday, Some may take a little longer (Mainly on the more difficult subjects)
*NOTE* This tutorial takes in mind that you already have Visual Studio installed. I will not be providing a link to this Google ftw.
*NOTE* Also note that this tutorial may or not be beneficial to you, Tbch i am not doing this for you, its mainly for myself.
First lesson: Data types, Literals, and Variables.
Data types, Literals, and Variables.
In C# there are two general categories of build-in data types : Value types and reference types.
Code:
bool --- Represents true/false values
byte --- 8-bit unsigned integer ( 0 to 255)
char --- character
decimal --- Numeric type Usually meant to deal with Financial calcs
double --- double precision floating point
float --- single precision floating point
int --- Integer ( -2,147,483,648 to 2,147,483,647)
long --- Long integer ( -9,223,372,036,854,775,808 to 9,223,372,036,854,775,808)
sbyte --- 8-bit signed integer( -128 to 127)
short --- short integer ( -32,768 to 32,767)
uint --- a unsigned integer ( 0 to 4,294,967,295)
ulong --- a unsigned long integer ( 0 to 18,446,744,073,709,551,615)
ushort --- a unsigned short integer( 0 to 65,535)
Now floating point types are a little different they can have fractional components which are Float and Double.
Code:
Float = 1.5^-45 to 3.4^ 38
double = 5^-324 to 1.7^308
As you can see there is a huge difference in both of them.
Now decimals i really do not feel like going into, If you want to look into them you can try google. Basically you can use decimals lol...
Ok now that we have gone over the numbers lets go over Characters. C# uses a 16-bit character type called Unicode(google it)
Code:
char is a usigned 16-bit type with a range of 0 to 65,535 characters.
But since we are using Unicode the normal range is from 0 to 127
[EXAMPLE]
char ch;
ch = "x";
Console.Writeline("This is ch: " + ch);
Output = This is ch: x
Now what i am about to show you involves if statements, but since we have not discussed if statements focus on the VARIABLES and that's it nothing else.
Code:
static void Main(string[] args)
{
int x; // THIS CODE IS KNOWN ONLY Main()
x = 10;// Defining our variable
if (x == 10)// pay no attention to the If statement
{
int y = 20;// We are defining another variable in this case the variable is y
Console.WriteLine("x and y: " + x + " " + y);// This is just writing to the console the values of x and the value of y
}
Console.ReadLine();
}
The point to that example there is to show how variables can be defined in 2 separate ways.
Automatic conversions and Casting
Code:
In c# it is fairly common to assign one type of variable to another, such as assigning an int value to a float variable.
EXAMPLE
int i;
float f;
i = 10;
f = i;
When types are mixed in an assignment, the value of the right side is automatically converted to the type of the left side. In the example above the value of i is converted into a float and then assigned to f. BUT there is an exception to this rule not all types can be converted to each other this way.A bool can not be converted to an int this way. This is where we get into casting methods.
For other cases you can do this by the example below
EXAMPLE
(target type)expression
u = 32000
s = (short) u;
Well that about does it for this lesson, If you want some more practice just try small programs. Messing around with variables until you are comfortable with them.
Lesson 2 - Operators
Most of C#'s operators fall under the following categories
Code:
Code:
arithmetic
bitwise
relational
logical
C# also defines several other operators that handle special situations, such as array indexing and member access. We will talk about those in later lessons.
Code:
+ -- Addition
- -- Subtraction
* -- Multiplication
/ -- Division
% -- Modulus
++ -- Increment
-- -- Decrement
The +,-,*, and / all work the same way in C# as they do in any other computer language( or in algebra for that matter) They can be applied to any numerical data type.
Code:
NOTE
When the / is applied to an integer, any remainder will be truncated
EXAMPLE
10/3 will equal 3 in integer division. You can obtain the remainder by using the Modulus symbol % (sometimes referred to as the remainder operator)
EXAMPLE
10%3 is 1
Code:
EXAMPLE
static void Main(string[] args)
{
int irseult, irem;
double dresukt, drem;
irseult = 10 / 3;
irem = 10 % 3;
dresukt = 10.0 / 3.0;
drem = 10.0 % 3.0;
Console.WriteLine("Result and remainder of 10/3 : " + irseult + " " + irem);
Console.WriteLine("Result and remainder of 10.0 / 3.0 " + dresukt + " " + drem);
Console.ReadLine();
}
Console output is
Result and remainder of 10/3 : 3 1
result and remainder of 10.0/3.0 : 3.33 1
As you can see the % yeilds a remainder of 1 for both integer and floating point expressions.
Increments
Code:
Increments add 1 to a variable so lets try this out
this is just a quick example
x = x+ 1; means the same thing as
x++;
and x = x - 1; means the same thing as
x--;
These can be written either in the prefix form (--x) or the postfix form ( x++) either way its just depends on how you would like to do it.
Regional and local Operators
Code:
Relational operators
= = Equal to
!= Not equal to
> greater than
< less than
>= greater than or equal to
<= less than or equal to
Code:
Local operators
& AND
| or
^ XOR(exclusive or)
|| Short circuit or
&& Short circuit AND
! NOT
The outcome of the relational and logical operators is a bool value(very important)
Only the relational operators can be applied to numeric types.
Well for now this is all for lesson 2, I would suggest looking into combining lessons 1 & 2 and making a small program for fun and for more practice
Lesson 3 - Program Control Statements
Code:
In this lesson i will cover the if statement
the switch statement
MOST loops for,while,foreach and MAYBE do-while
AND the break,continue,goto,return,and throw statements
The If - else statements
Code:
This is the standard for the if - else statement
if (condition)
{
statement
}
else
{
statement
}
*NOTE* You do not have to use brackets, but i prefer to cause it makes the code cleaner and is easily readable
The program will read the if(condition) if that condition is met it will execute the statement in the brackets. If not it will jump to the else
and preform whatever is in those brackets. *NOTE* the else is completely optional you do not have to have it.
Code:
Nested If statements
a nested if is an if statement that is the target of another if or else. Nested ifs are very common in C#. The main thing to remember about nested ifs in C# is that an else statement always refers to the nearest if statement that is within the same block as the else and not already associated with an else
EXAMPLE
int i = 10;
if (i == 10)
{
int j;
if (j < 20)
{
a = b;
int k;
if (k > 100)
{
c = d;
}
else// this else refers to if(k>100)
{
a = c;
}
}
}
else // this else refers to if(i == 10)
{
a = d;
}
Now on this example i obviously have not defined all my variables and that's okay because it is just an example lol
The final else is not associated with if(j<20) because it is not in the same block. Rather, the final else is associated with if(i==10).
The inner else refers to if(k>100), because it is the closest if within the same block.
the if-else-if ladder
Code:
a common programming construct that is based upon the nest if is the if-else-if ladder. it looks like this
if(condition)
{
statement
}
else if (condition)
{
statement
}
else if (condition)
{
statement
}
Now since its late as hell here and im running on a hour of sleep there may be mistakes. Also this is not done i will continue to go over it later when im not so sleepy
UPDATED 5-6-12
|
|
|
04/30/2012, 07:22
|
#2
|
elite*gold: 0
Join Date: Apr 2012
Posts: 134
Received Thanks: 30
|
i've always want to do the same thing but i've always said , if i don't understand it good enough i won't be able to explain it simply enough to others , anyway lemme see how good your progress is
|
|
|
04/30/2012, 08:56
|
#3
|
elite*gold: 0
Join Date: Dec 2011
Posts: 1,537
Received Thanks: 785
|
Good luck with the tutorials bro ^^
|
|
|
04/30/2012, 12:00
|
#4
|
elite*gold: 0
Join Date: Jul 2010
Posts: 1,532
Received Thanks: 575
|
Quote:
Originally Posted by DyjgK64J451Jhv0
i've always want to do the same thing but i've always said , if i don't understand it good enough i won't be able to explain it simply enough to others , anyway lemme see how good your progress is 
|
Wasn't that Einstein?
|
|
|
04/30/2012, 12:48
|
#5
|
elite*gold: 0
Join Date: Dec 2011
Posts: 1,537
Received Thanks: 785
|
Quote:
Originally Posted by Captivate
Wasn't that Einstein?
|
Touché
|
|
|
04/30/2012, 13:44
|
#6
|
elite*gold: 0
Join Date: Apr 2012
Posts: 134
Received Thanks: 30
|
Quote:
Originally Posted by Captivate
Wasn't that Einstein?
|
yes , clever , now search for the thread i've said there that it's mine , so u win the biggest prize =))
@buss , that's not true , no erection yet !
|
|
|
04/30/2012, 14:14
|
#7
|
elite*gold: 20
Join Date: Dec 2006
Posts: 945
Received Thanks: 175
|
Yeah it's kind of just a refresher for myself, but i will keep it updated whenever i get home from work
#updated original post
|
|
|
05/02/2012, 21:10
|
#8
|
elite*gold: 0
Join Date: Feb 2012
Posts: 46
Received Thanks: 12
|
Looking forward to more adv tuts. I like the detail. Don't quit on us, you've made a commitment now!
|
|
|
05/02/2012, 23:31
|
#9
|
elite*gold: 20
Join Date: Dec 2006
Posts: 945
Received Thanks: 175
|
#updated original post,
Its kind of a half lesson at the moment because i have to leave so i will finish it up tonight
|
|
|
05/06/2012, 18:57
|
#10
|
elite*gold: 20
Join Date: Dec 2006
Posts: 945
Received Thanks: 175
|
#updated original post
|
|
|
05/08/2012, 14:58
|
#11
|
elite*gold: 20
Join Date: Aug 2007
Posts: 1,749
Received Thanks: 2,199
|
if (true)
{
if (true)
{
if (true)
{
if (true)
{
thisIsUnreadable = true;
}
}
}
}
You should really use indentation.
|
|
|
 |
Similar Threads
|
suche autoit follow bot (follow me v1-v2)
01/27/2012 - Diablo 2 - 10 Replies
glaube so hiess der follow me
der war mit autoit geschrieben, leider finde ich den nicht mehr.
der war recht simpel gehalten. glaub mit f9 hat man den aktiviert und mit f10 kurz ausgemacht
wäre nice wenn den von euch jemand hat und hier posten könnte
|
[Release/Tutorial] Follow The Leader Vac (WZ Mob Mind Control) - Made by iSean
01/02/2011 - MapleStory - 1 Replies
Follow The Leader Vac (WZ Mob Mind Control) - Made by iSean
How to make your own Follow the Leader Vac
Full Credits from Founder:
-iSean
-Other People found it early than me
1. Open HaRepacker.
2. Change your MapleStory Type to "GMS" / "KMS/EMS/MSEA" / "BMS"
3. Load Your Mob.wz
|
Alkey99 Tricks of blackwalllhack to make it work follow the vedio Tutorial
12/20/2010 - Soldier Front Philippines - 2 Replies
Alkey99 Tricks to make the Hack Work watch his mouse and follow the tutorial below this is from mammothz black wallhack works on windows xp sp3..
Youtube: YouTube - Simple Trick Mammothz.mp4
Youtube: YouTube - ALKEY99 GG EMULATOR BLACK WALLHACK Nov. 27 2010.mp4
Windows xp Sp3 Updated : http://www.microsoft.com/downloads/en/confirmation .aspx?FamilyId=5B33B5A8-5E76-401F-BE08-1E1555D4F3D 4&displaylang=en
|
Proxy + whisper follow (why the follow function is essential)
10/22/2007 - Conquer Online 2 - 3 Replies
Alright, here's the thing. After ape city spawns were totally messed up, it has become impossible for my chars to gain enough vps to go to lab.
There are no more spawns where you can sit and plvl noobs, you have to keep moving. This creates an obvious problem if you want your tro or warrior to be team leader and plvl with your archer.
All the noobs autofollow the tro/war, while your powerlevelling on your archer.
Venom's proxy has disabled follow name in whisper. Is there another...
|
All times are GMT +1. The time now is 21:43.
|
|