Another Template Problem

Hello you guys...trying out new programs using the template class T...I'm really new at this sort of things and would be thankful if anyone could help me...Here is my program:I'm trying to enter data and read into array then print out all the grades in descending order also printing out the highest, lowest, average and the number of grades that are below average....this is what I have:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <iostream>
using namespace std;

template <class T>
void printArray( const T *Array, int count)
{
	for ( int i = 0; i < count; i++)
		cout<<Array[i]<<"   ";
	    cout<<endl;
}
void printArray( const T *Array, int count, int low, int high)
void BubblesortArray( T *a, const int count)
    T temp;
    bool swapped;
    	do {
        	swapped = false;
        	for(int i = 1; i < count; i++)
	   {
            if (a[i] < a[i - 1]) 
	      {
                temp = a[i];
                a[i] = a[i - 1];
                a[i - 1] = temp;
                swapped = true;
              }
           }
          		while( swapped == true );
	   }
int main()
{
	const int a;
	const int b;
	const int c;
	int a[6];
	double b[6];
	char c[6];
	int size, i, grades;
		 cout <<"HOW MANY STUDENTS? \n";
   		 cin >> size;
	StudentGrade *st = new StudentGrade[size];
    		 for(i = 0; i < size; i++){ st[i].setgrade(); }

	    for (int row=0; row <5; row++){for (int col=0; col <1; col++) 
		{
            cout << "Enter Grades : ";
             cin >> grades[row][col];
        }
             }

     	 cout << "LIST OF ALL THE GRADES";//But it's not descending
         cout << "\n\n";
        for (int row=0; row <5; row++){for (int col=0; col <1; col++) 
		{
             if(grades[row][col] >= 0){cout << "\n" << grades[row][col]              
                << " ";
                                 
             }
             }
             }
           
        cout << "LIST OF HIGHEST GRADES";//But it's not descending
        cout << "\n\n";
       for (int row=0; row <5; row++){for (int col=0; col <1; col++) 
	   {
             if(grades[row][col] >= 75){cout << "\n" << grades[row][col]              
                << " ";
                                 
             }
             }
             }
    
        cout << "\n\n";
        cout << "LIST OF LOWEST GRADES";//But it's not descending
        cout << "\n\n";
       for (int row=0; row <5; row++){for (int col=0; col <1; col++) 
	   {
             if(grades[row][col] < 75){cout << "\n" << grades[row][col]              
                << " ";
                                 
             }
             }
             }
	printArray(a, 5);
	printArray(b, 5);
	printArray(c, 5);
	return 0;
}
What's the question/problem?
I'm trying to enter data and read into array then print out all the grades in descending order also printing out the highest, lowest, average and the number of grades that are below average.......this is what I get:


.\grades.cpp(32) : error C2734: 'a' : const object must be initialized if not extern
.\grades.cpp(33) : error C2734: 'b' : const object must be initialized if not extern
.\grades.cpp(34) : error C2734: 'c' : const object must be initialized if not extern
.\grades.cpp(47) : error C2109: subscript requires array or pointer type
.\grades.cpp(55) : error C2109: subscript requires array or pointer type
.\grades.cpp(55) : error C2109: subscript requires array or pointer type
.\grades.cpp(66) : error C2109: subscript requires array or pointer type
.\grades.cpp(66) : error C2109: subscript requires array or pointer type
.\grades.cpp(78) : error C2109: subscript requires array or pointer type
.\grades.cpp(78) : error C2109: subscript requires array or pointer type
You have a lot worst problems than those in your program. I will help you with the errors you pointed out though.

The errors are self explanatory, 'const object must be initialized if not extern'.

1
2
const int a; //Wrong
const int a = 5; // 'a' is now initialized to 5 


'grades' is an integer type and yet you are trying to treat it as a two dimensional array.
So can you tell me or show me how I can get this program to work??? It's been driving me crazy now for days...I must know if it can work or not...Thank you
Assuming you've fixed all the errors, what part of the logic are you having trouble with?
Thanks for all you guys help.......
Topic archived. No new replies allowed.