Compiling Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marmar12
    New Member
    • Mar 2008
    • 11

    Compiling Error

    I'm not sure if it's a flow issue or I'm missing some code, but I'm having a lot of trouble compiling this program. It is a Grade Calculator averaging the HW, Proj, and Exam and weighing them to find the final grade. Please help.

    #include <stdio.h>
    int man()

    {

    int my grade; /* user's grade */

    printf ("welcome....." );

    printf("Enter HW1 score (out of 100");
    scanf("%d"; "HW1=a");

    printf("Enter HW2 score (out of 100");
    scanf("%d"; "HW2=b");

    printf("Enter HW3 score (out of 100");
    scanf("%d"; "HW3=c");

    printf("Enter Proj1 score (out of 100");
    scanf("%d"; "Proj1=A");

    printf("Enter Proj2 score (out of 100");
    scanf("%d"; "Proj2=B");

    printf("Enter Proj3 scanf("%d"; "HW1=a");
    scanf("%d"; "Proj3=C");

    printf("Enter Proj4 score (out of 100");
    scanf("%d"; "Proj4=D");

    printf("Enter Exam1 score");
    scanf("%d"; "Exam=E");

    printf("Enter Exam2 score");
    scanf("%d"; "Exam2=F");

    printf("Enter Exam3 score");
    scanf("%d"; "Exan3=G");

    Avg_HW=(a+b+c)/3=v1
    Avg_Proj=(A+B+C +D)/4=v2

    return 0;
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Yeah, I can seet that.

    1) main() is mis-spelled
    2) your parentheses are not balanced in all cases
    3) you cannot scanf() into a literal. You need a variable. If you meant to display befoire scanning, then use a printf() before the scanf(). All the sacnf() wants is the kind of data (the % specifier) and the address of the variable where the data is to go.

    Good luck.

    Comment

    • marmar12
      New Member
      • Mar 2008
      • 11

      #3
      i have one main question though, in order for me to store the numbers that the user is going to input, do i use scanf or some other command?

      Comment

      • sanctus
        New Member
        • Mar 2007
        • 84

        #4
        Also, I do not know if
        [code=cpp]
        int my grade
        [/code]
        is allowed since it is made of 2 words... Shouldn't it be:
        [code=cpp]
        int my_grade
        [/code]

        Comment

        • weaknessforcats
          Recognized Expert Expert
          • Mar 2007
          • 9214

          #5
          Originally posted by marmar12
          i have one main question though, in order for me to store the numbers that the user is going to input, do i use scanf or some other command?
          Yes, you use scanf() or any of the other commands than fetch data from the standard input.

          Comment

          Working...