Ask Experts Questions for FREE Help !
Ask
    toryadamz's Avatar
    toryadamz Posts: 18, Reputation: 0
    New Member
     
    #1

    Feb 28, 2007, 09:00 AM
    where is the error i cant find it
    where is the error? It says this:
    grades.c: In function `main':
    grades.c:7: error: array size missing in `grade'
    grades.c:7: error: conflicting types for `grade'
    grades.c:7: error: previous declaration of `grade'
    grades.c:58: error: subscripted value is neither array nor pointer
    grades.c:59: error: subscripted value is neither array nor pointer
    grades.c:61: error: subscripted value is neither array nor pointer
    grades.c:62: error: subscripted value is neither array nor pointer
    grades.c:64: error: subscripted value is neither array nor pointer
    grades.c:65: error: subscripted value is neither array nor pointer
    grades.c:71: error: syntax error before "int"
    grades.c:77: error: syntax error before ')' token
    grades.c:80: error: subscripted value is neither array nor pointer
    grades.c:81: error: subscripted value is neither array nor pointer
    grades.c:81: error: subscripted value is neither array nor pointer
    grades.c:83: error: subscripted value is neither array nor pointer
    grades.c:83: error: subscripted value is neither array nor pointer
    grades.c:85: error: subscripted value is neither array nor pointer
    grades.c:85: error: subscripted value is neither array nor pointer
    grades.c:87: error: subscripted value is neither array nor pointer
    grades.c:87: error: subscripted value is neither array nor pointer
    grades.c:89: error: subscripted value is neither array nor pointer
    grades.c:89: error: subscripted value is neither array nor pointer

    SOURCE CODE:





    #include<stdio.h>
    #include<math.h>

    main()
    {

    int j, c, grade[], number_of_grades, sum, I, grade, grade_total = 0, failure_count = 0;
    double pow(double x, double y);
    double sqrt(double x);
    double standard_dev;
    float average, variance, high, low;

    printf("How many grades will you be entering?"
    "(must be in between 0 and 100");
    scanf("%i", &number_of_grades);

    if ( number_of_grades < 0 || number_of_grades > 100){
    printf("ERROR: You have entered a number to large"
    "or to small for the program to calculate"
    "number must be in between 0 and 100, and"
    "must be a whole number.\n");
    return 0;
    }



    for(I=1; I <= number_of_grades; ++i )
    {
    printf("Enter grade #%i:", I);
    scanf("%i", &grade );

    if (grade < 0){
    printf("ERROR: You have entered a number"
    "not within the domain.\n");
    return 0;}
    if (grade > 100){
    printf("ERROR: You have entered a number"
    "not within the domain.\n");
    return 0;}

    grade_total = grade_total + grade;

    if ( grade < 65 )
    ++failure_count;



    average = (float) grade_total / number_of_grades;

    sum = 0;
    for (I=0;i<=number_of_grades-1;++i){
    sum = sum + pow((grade - average),2);
    }
    variance = sum / (number_of_grades - 1);

    standard_dev = sqrt(variance);

    high = grade[0];
    low = grade[0];
    for( I=1;i<=number_of_grades -1;++i ){
    if (grade[i] > high){
    high = grade[i];
    }
    if (grade[i] < low){
    low = grade[i];
    }

    }

    int c[5]
    int c[4]
    int c[3]
    int c[2]
    int c[1]
    int c[0]

    for (j=0; j<=4; ++j){
    c [j]=0}
    for (I=0; I<= number_of_grades-1;++i){
    if (grade[i] > 89)
    c[0] = c[0] + 1;
    else if (grade > 79)
    c[1] = c[1] + 1;
    else if (grade > 69)
    c[2] = c[2] + 1;
    else if (grade > 59)
    c[3] = c[3] + 1;
    else
    c[4] = c[4] + 1;
    }









    printf("\nGrade average = %.2f\n", average );
    printf("Number of failures = %i\n", failure_count );

    return 0;



    }
    toryadamz's Avatar
    toryadamz Posts: 18, Reputation: 0
    New Member
     
    #2

    Feb 28, 2007, 09:33 AM
    Never mind people I figured it out
    asterisk_man's Avatar
    asterisk_man Posts: 476, Reputation: 32
    Full Member
     
    #3

    Feb 28, 2007, 09:36 AM
    First error is that grade[] requires a number for the size of the array, like grade[10].
    Also, you can't define an array and an int with the same name "grade".

    Hard to find the next errors since you didn't include line numbers. I can tell you there are places where you use grade by itself without any index.

    Fix these errors and try again.
    toryadamz's Avatar
    toryadamz Posts: 18, Reputation: 0
    New Member
     
    #4

    Feb 28, 2007, 09:41 AM
    k here is what I am down to
    it says I have an error at the very end of the program

    1.#include<stdio.h>
    2.#include<math.h>
    3.
    4.main()
    {

    int j, c, scores[100], number_of_grades, sum, I, grade, grade_total = 0, failure_count = 0;
    double pow(double x, double y);
    double sqrt(double x);
    double standard_dev;
    float average, variance, high, low;

    printf("How many grades will you be entering?"
    "(must be in between 0 and 100");
    scanf("%i", &number_of_grades);

    if ( number_of_grades < 0 || number_of_grades > 100){
    printf("ERROR: You have entered a number to large"
    "or to small for the program to calculate"
    "number must be in between 0 and 100, and"
    "must be a whole number.\n");
    return 0;
    }



    for(I=1; I <= number_of_grades; ++i )
    {
    printf("Enter grade #%i:", I);
    scanf("%i", &grade );

    if ( grade = -9 ){
    printf("END OF STATS\n");
    return 0;
    }

    else if (grade < 0 || grade > 100)
    {
    asterisk_man's Avatar
    asterisk_man Posts: 476, Reputation: 32
    Full Member
     
    #5

    Feb 28, 2007, 10:56 AM
    Looks like your program is cut off before the end. Can you paste it again or point to which line above the error is supposed to be on? Also, always give the entire error message so I know what to look for.

    Thanks

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Oracle Error 12560:tns Protocol Adapter Error [ 3 Answers ]

Hi, Whenever I try to log in using SCOTT/TIGER userid, I get the error "ORA ERROR 12560:TNS PROTOCOL ADAPTER ERROR". I tried starting the listener from administration-> services, but still the problem persists. Can you please suggest a solution?

Printing Error-Script Error [ 1 Answers ]

When I try to print a window pops up: Internet Explorer Script Error Line:1174 I have tried several things: Quick Restore, checked Script debugging box.

Error 0x800ccc0d [ 2 Answers ]

Every time I try to sent a file or folder I get this erroe it says yahoo.com was not found.I think my kids did this or husbabnd could you help me fix this so I can send pics from a file or any other file please

Error [ 2 Answers ]

I have a game I tried to download and all that comes up is the message as follows. 16 bit c drive / autoexc.nt system file not suitable. It's a old game that says for win 95 and I have a win. XP does this matter? Thank you


View more questions Search