Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9

Thread: C# assistance

  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    C# assistance

    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!

  • #2
    Regular Coder
    Join Date
    Dec 2011
    Location
    NW England
    Posts
    194
    Thanks
    8
    Thanked 15 Times in 15 Posts
    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, 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.

  • #3
    New Coder
    Join Date
    Jan 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    New Coder
    Join Date
    Jan 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #5
    Regular Coder
    Join Date
    Dec 2011
    Location
    NW England
    Posts
    194
    Thanks
    8
    Thanked 15 Times in 15 Posts
    Getting user input can be

    Code:
    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:
    Code:
    Console.WriteLine(name);
    Then that will display what they entered

  • #6
    New Coder
    Join Date
    Jan 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks!!! that helps a lot

  • #7
    New Coder
    Join Date
    Jan 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:
    Code:
    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);
            Console.ReadLine();
    
        
        }
    }

  • #8
    Regular Coder
    Join Date
    Dec 2011
    Location
    NW England
    Posts
    194
    Thanks
    8
    Thanked 15 Times in 15 Posts
    When you want to get input that is a number you use:
    Code:
    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)
    Last edited by melloorr; 01-03-2012 at 12:34 PM.

  • #9
    New Coder
    Join Date
    Jan 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    alright cool
    thanks so much for helping me, I've learned a lot just from you.
    Last edited by comfroels; 01-03-2012 at 07:25 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •