Im trying to add up 100 grades and get the averge but it wont compile because it "cannot convert from 'int' to 'int [100].
Can anyone help me??

#include "stdafx.h"
#include <iostream>
using namespace std;


int main()
{
	int total, j;
	double average;
	int grade[100]= (56,97,73,59,68,79,86,67,79,66,
					 95,64,98,56,79,83,75,89,73,91,
					 52,72,63,81,62,85,37,78,100,89,
					 56,89,75,76,99,66,84,98,68,59,
					 98,77,96,88,67,88,95,79,56,79,
					 56,97,43,59,68,79,85,67,79,66,
					 95,64,98,65,79,83,75,89,73,91,
					 52,72,63,49,62,85,37,78,100,89,
					 84,89,75,76,99,66,84,98,68,59,
					 98,77,96,88,67,88,95,79,56,79);
	char pause;

	for(int j=0; j<100; j++)
	{
		total=total + grade[j];
	}
		average=total/100;

	cout<<"Your average is "<<average<<endl;
	cin>>pause;
	return 0;
}

Good first post! Good title, Code with tags, mildly useful description. All in all, a great first effort.

Unfortunately, you didn't post the entire error message. Also didn't mention what line the error is on. I don't see any lines that would have that error, either. Please add a few more details and we're in business.

!!!Initialize your variables!!!

You have three errors in your code. first you when you declare the vairbable "total" you have to intialize "total" before using it. like

int total = 0;

then when you create an array. you use curly braces like this
int grade[1] = {1,2};
third when you run for loop you declared again the variable "j" in the for loop declaration section

// you wrote
for(int j=0; j<100; j++)	

// my suggetion 
for(j=0; j<100; j++)	
	{		
		total += grade[j];

	}	
{

Hope it helped.

#include "stdafx.h"
#include <iostream>
using namespace std;


int main()
{
	int total = 0;
	double average = 0.0;
	int grade[100]= {56,97,73,59,68,79,86,67,79,66,
					 95,64,98,56,79,83,75,89,73,91,
					 52,72,63,81,62,85,37,78,100,89,
					 56,89,75,76,99,66,84,98,68,59,
					 98,77,96,88,67,88,95,79,56,79,
					 56,97,43,59,68,79,85,67,79,66,
					 95,64,98,65,79,83,75,89,73,91,
					 52,72,63,49,62,85,37,78,100,89,
					 84,89,75,76,99,66,84,98,68,59,
					 98,77,96,88,67,88,95,79,56,79};
	char pause;

	for(int j=0; j<100; j++)
	{
		total=total + grade[j];
	}
		average=total/100;

	cout<<"Your average is "<<average<<endl;
	cin>>pause;
	return 0;
}

I think this will work (can't test it right now)
I removed the int j on line 8,.
Initialized the int total on line 8.
Used curly braces on on line 10 and 19.
Well, that was it.
You might want to init the char pause on line 20, but it isn't necessary.
Clean code BTW

commented: Do not write people's code for them. This includes fixing it. -2
commented: Disagree with Walt, the few points you changed were properly explained +12

Ok thanx you guys, simple mistakes lol, i feel stupid. But thank you all for the help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.