Ask Experts Questions for FREE Help!
  Advanced
Register  |  Log in  
   Ask    
 Answer  
  Help  

Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
Free Answers in 3 Easy Steps

Register Now
3 Steps

At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.

Home > Computers & Technology > Programming > Compiled Languages > C   »   where is the error i cant find it

 
Question Tools Search this Question Display Modes
Question
 
 
#1  
Old Feb 28, 2007, 07:00 AM
toryadamz
New Member
toryadamz is offline
 
Join Date: Feb 2007
Posts: 18
toryadamz See this member's comment history on his/her Profile page.
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;



}

Reply With Quote
 
     

Answers
 
 
Old Feb 28, 2007, 07:33 AM   #2  
toryadamz
New Member
toryadamz is offline
 
Join Date: Feb 2007
Posts: 18
toryadamz See this member's comment history on his/her Profile page.
never mind people i figured it out
  Reply With Quote
 
     
 
 
Old Feb 28, 2007, 07:36 AM   #3  
asterisk_man
Full Member
asterisk_man is offline
 
asterisk_man's Avatar
 
Join Date: Nov 2006
Location: East coast of U.S.A.
Posts: 472
asterisk_man See this member's comment history on his/her Profile page.
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.

Comments on this post
toryadamz agrees: it was helpful because i fixed it
  Reply With Quote
 
     
 
 
Old Feb 28, 2007, 07:41 AM   #4  
toryadamz
New Member
toryadamz is offline
 
Join Date: Feb 2007
Posts: 18
toryadamz See this member's comment history on his/her Profile page.
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)
{
  Reply With Quote
 
     
 
 
Old Feb 28, 2007, 08:56 AM   #5  
asterisk_man
Full Member
asterisk_man is offline
 
asterisk_man's Avatar
 
Join Date: Nov 2006
Location: East coast of U.S.A.
Posts: 472
asterisk_man See this member's comment history on his/her Profile page.
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
  Reply With Quote
 
     


Question Tools Search this Question
Search this Question:

Advanced Search
Display Modes

 
Similar Sponsors

Similar Questions
Question Asker Topic Answers Last Post
Printing Error-Script Error yankees007 Cell Phones 1 Jun 27, 2008 01:59 AM
Oracle Error 12560:tns Protocol Adapter Error praveen_369 Oracle 2 Mar 27, 2007 06:49 PM
script error Twmac Windows 0 Oct 29, 2006 06:46 AM
error 0x800ccc0d anniepie Email 2 Jan 10, 2006 03:11 AM
error ronnieca1955 Desktops 2 Sep 27, 2005 12:09 PM




Copyright ©2003 - 2007, Ask Me Help Desk.
All times are GMT -8. The time now is 05:04 PM.

Content Relevant URLs by vBSEO 3.0.0 RC6 © 2006, Crawlability, Inc.