Thread: Need help.

  1. #1
    Registered User
    Join Date
    Dec 2012
    Posts
    1

    Need help.

    Hello guys,

    I'm a C beginner, trying to teach myself the language, but I'm currently struggling with a code.


    I was wondering if I could get some assistance.

    * I want the code to ask for a number of students.
    * The number of students will represent the size of the loop that I need.
    * During the loop, the console will ask the user for a name and a number of tests.
    * It should get the name and number of test.
    * Then, a loop should come in and add up the sum of all test by that student and compute the average.
    * The console should output the name of the student and average.


    I have all the logic down I'm just having trouble translating the code from VB.NET. The syntax is completely different and I'm still learning the basics of C.

    I was wondering if I could obtain some help writing that code.

    Thanks in advance.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    You can save yourself a LOT of time, by first running through the C tutorial linked to the C Tutorial tab, at the top dead center of the website. It will answer a HUGE number of questions you will have. Be ready to take notes, as well, for future reference.

    As soon as you're ready with a start to your program code, if/when you get stuck, by all means, post up your code (always using code tags around your code), and tell us what the problem is.

    We're very helpful, but it's up to you to make that start on your code.

    And Welcome to the forum, Noct!

  3. #3
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    > I want the code to ask for a number of students.
    This can be done using a printf/puts & scanf


    > The number of students will represent the size of the loop that I need.
    A for loop looks different, but behaves similar to the VB format
    Instead of:
    Code:
    ' VB
    dim intCount As Integer
    For intCount = 10 To 1 Step -1
        'Statements in body of loop
    Next intCount
    
    /* C */
    int count;
    for (count = 10; count >= 1; count = count - 1)
    {
        /* Statements in body of loop */
    }

    Have a close look at C Tutorial - Learn C - Cprogramming.com

    You should pick it up very quickly
    Fact - Beethoven wrote his first symphony in C

Popular pages Recent additions subscribe to a feed