View Full Version : C# assistance

01-02-2012, 07:52 AM
Hi, I'm kind of new to the forum so I apologize in advance if there is already a thread on this,
I've been trying to go through a C# book, and I have a strong computer background, just not so much in the programming field.
Are there any good tutorials or webinars that anyone would suggest?
Any help would be appreciated!

01-02-2012, 04:18 PM
Well that would depend on a lot of things, for instance, how much have you learned? But if you really do want to get better, tutorials are not the way forward, they do not let you think about a problem, they just guide you through it, doing all the work.

You really learn more when YOU are trying to work out a problem. If you need something to do, here is a list that I made up (http://www.codingforums.com/showpost.php?p=1175459&postcount=12), that should test you the basics, and you should learn a lot. If you need any help with any of them, then just ask on here, and we will help you.

01-02-2012, 06:37 PM
thanks so much!
i'm still just beginning, I've gone through structuring classes, using constructs and methods, I'm just not so sure on some of them and how they affect the others.
I'll work through those and see what I can come up with.

01-03-2012, 03:39 AM
Well I see that I haven't even scratched the surface.
I am not even sure how to take input from a user.
I guess I'll keep going through my book for a while longer.

My book is Programming C# by Jesse Liberty (Published by O'Reilly), it has a lot of high level vocabulary that is difficult to actually put into context. You are also correct in that typing in the programs in the book is not helping me actually learn the theory behind the syntax. I appreciate the help.

01-03-2012, 03:47 AM
Getting user input can be

Console.WriteLine("Please enter your name: ");
string name = Console.ReadLine();

That will make name, equal to what they input. So when you want to call it, you use:
Then that will display what they entered

01-03-2012, 05:12 AM
thanks!!! that helps a lot

01-03-2012, 05:41 AM
Would you be able to tell me why I am getting the error:
"cannot implicitly convert type string to int" in this code, just trying to play with some stuff.
I thought I initialized it as an integer:

using System;

public class Average
public static void Main()
Console.WriteLine("Please enter your first test score: ");
int test1 = Console.ReadLine();
Console.WriteLine("Please enter your second test score: ");
int test2 = Console.ReadLine();
Console.WriteLine("Please enter your second test score: ");
int test3 = Console.ReadLine();

int average = (test1 + test2 + test3) / 3;

Console.WriteLine("Your test average is: {0}", average);


01-03-2012, 12:26 PM
When you want to get input that is a number you use:

int test1 = int.Parse(Console.ReadLine());

That will convert (parse) what the user inputted to an int. But be careful, if a user enters any letters, they will get an error and the program will crash. To avoid this, you use Exception Handling (Try and Catch)

01-03-2012, 07:22 PM
alright cool
thanks so much for helping me, I've learned a lot just from you.