Thread: C programming help

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    10

    C programming help

    I need some help...
    I have to make a C programme which will output the student grade as a fail or a pass , or distinction

    Must allow the user to input grade using a keybord

    >82%=Distinction
    >75%=Merit
    >30%=Pass

    I have done a code smiler to this but i keep coming into errors, I would like to compare someone else code to mine to find my errors and see where I have gone wrong

  2. #2
    Registered User
    Join Date
    Sep 2012
    Posts
    357
    Post your code and the errors.
    Surely we will point out to you the reason for the errors and how to correct them.

  3. #3
    Registered User
    Join Date
    Jan 2011
    Posts
    29
    First thing you'll want is to read in a score from the user...what part of your program is giving you problems?

    Code:
    
    #include <stdio.h>
    #include <stdlib.h>
    
    
    int main () {
    
    
    int score;
    
    printf("Enter student's score: \n");
    scanf("%d", score);
    
    
    system("pause");
    return (0);
    
    }

  4. #4
    Registered User
    Join Date
    Sep 2012
    Posts
    357
    Quote Originally Posted by UCFuser View Post
    First thing you'll want is to read in a score from the user...

    Code:
    int score;
    
    printf("Enter student's score: \n");
    scanf("%d", score);
    I think you mean
    Code:
    scanf("%d", &score);

  5. #5
    Registered User
    Join Date
    Jan 2011
    Posts
    29
    Quote Originally Posted by qny View Post
    I think you mean
    Code:
    scanf("%d", &score);
    Yes you're correct, wrote that segment very quickly

  6. #6
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,229
    scanf("%i", &score); will also work, it allows the user to type a number in a lot of different number systems without extra work: decimal, hexadecimal, and octal. I've started to use it, especially when I just want a number and don't care about representations, which is true a lot of the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 09-11-2012, 01:03 AM
  2. Replies: 4
    Last Post: 12-11-2011, 04:25 PM
  3. small programming job VCPP / Object Oriented Programming
    By calgonite in forum Projects and Job Recruitment
    Replies: 10
    Last Post: 01-04-2006, 11:48 PM
  4. Total newb to programming here... Question about the many programming languages. Ty!
    By tsubotakid1 in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 10-05-2003, 10:32 AM