PostC# Tutorial, starting, learning the basics, and keeping...

Posts 16–21 of 21 · Page 2 of 2
Code:
int[] yourarray = new int[100];
int[,] myarray = new int[100,100];
int[,,] whysarray = new int[13,33,37];
Thats pretty much it to arrays ;P
No need for explaination as that would pretty much turn me into a captain obvious
hmm that's only determining the size of the array
I mean how u put stuff and take stuff out and access stuff in the array
Quote Originally Posted by falzarex View Post
hmm that's only determining the size of the array
I mean how u put stuff and take stuff out and access stuff in the array
Code:
int[,] MyArray = new int[100,100];

MyArray[10,10] = 1;
MyArray[10,11] = 3;
MyArray[10,13] = 3;
MyArray[10,14] = 7;
this is seriously helpful i am a newbie who wants to help out mpgh community
some parts i have no idea what you are saying can you help me out... sort of like as simple as that. the string Name will get the value (or text) that you typed in the console and when Enter key is pressed.

*Now getting this into a Program (using the old eg.)

Code:

using System;

namespace ConsoleApplication1
{
public class Program
{
static void Main()
{
int a = 0;
int b = 0;

Console.WriteLine("Insert the age of the first person:");
a = Convert.ToInt32(Console.ReadLine()); //i do have here to use Convert.ToInt32() in here because he will need to convert the type string (text, etc.) into a INT, so it has a better way to compare, or do mats, w/e.
Console.WriteLine("Insert the age of the secound person:");
b = Convert.ToInt32(Console.ReadLine());

if (a > b) //this will compare 2 or more things (lets just stay with 2 for now...) it will check if a is bigger then b, and if it is, it will do:
{
Console.WriteLine("var a is Older then var b"); //since a were older (or bigger) then b, it will execute every instruction inside this { ... }
}
else //if a isnt bigger then b, then he will do this (just like our language: If i'm a boy, i will like girls, Else i will like boys.
{
no idea.... XD
Quote Originally Posted by kobe.piercy View Post
some parts i have no idea what you are saying can you help me out... sort of like as simple as that. the string Name will get the value (or text) that you typed in the console and when Enter key is pressed.

*Now getting this into a Program (using the old eg.)
let me see if i understand your doupt, so you don't exactly know how Console.ReadLine(); works?

Well, if you already runned the program you will realise that the program will stop at the part where you have the Readline, waiting for you to write something, and he will only "read it" when you press <Enter>, then he will read the string that you wrote into the data type string or it will convert it into a INT datatype and then save it in a INT, and then the program will continue.

I hope you did understand it now, if not feel free to post again your doupt, or pm me ^^.

PS: Can't EDIT main post anymore ((
Posts 16–21 of 21 · Page 2 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us