i am getting an error list that consists of:.
>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(46) : error C2297: '>>' : illegal, right operand has type 'double'
1>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(46) : warning C4552: '>>' : operator has no effect; expected operator with side-effect
1>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(50) : error C2143: syntax error : missing ')' before ';'
1>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(50) : error C2059: syntax error : ')'
1>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(51) : error C2470: 'grade' : looks like a function definition, but there is no parameter list; skipping apparent body
1>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(60) : error C2061: syntax error : identifier 'sum'
1>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(65) : error C2563: mismatch in formal parameter list
1>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(65) : error C2563: mismatch in formal parameter list
1>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(65) : error C2065: 'G' : undeclared identifier
1>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(76) : error C2065: 'sizerow' : undeclared identifier
1>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(76) : error C2146: syntax error : missing ',' before identifier 'S'
1>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(78) : error C2065: 'sizerow' : undeclared identifier
1>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(80) : error C2109: subscript requires array or pointer type
1>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(82) : error C2109: subscript requires array or pointer type
1>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(84) : error C2109: subscript requires array or pointer type
1>c:\users\nathan\desktop\computer science\arraypractice\arraypractice\arraypractice.cpp(86) : error C2109: subscript requires array or pointer type
1>Build log was saved at "file://c:\Users\Nathan\Desktop\Computer Science\arraypractice\arraypractice\Debug\BuildLog.htm"
1>arraypractice - 27 error(s), 1 warning(s)
my program is as follows:
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 88 89
|
#include <iostream>
#include <fstream>
using namespace std;
const int row=4;
const int colo=3;
string name[row];
double grade[row][colo];
ifstream input1;input2;
void letter_grad(string name[row], double grade[row][colo]);
void read(string name[row], double grade[row][colo]);
void write(string name[row], double grade[row][colo]);
void total(double grade[row][colo], sum[row]);
void sum(double grade[sizerow][sizecolo], total [sizerow])
void main()
{
string n[row];
double G[row][colo];
read(name,grade);
write(name,grade);
avg(grade,size);
sum(grade,size);
char L[row];
double size[row];
double avg[row];
input1.close();
input2.close();
}
void read(string name[row], double grade[row][colo])
{
input1.open ("C:\\Users\\Nathan\\Desktop\\array.txt");
input2.open ("C:\\Users\\Nathan\\Desktop\\array1.txt");
for (int r=0; r<row; r++)
{
input1>>name[row];
for (int c=0; c<colo; c++)
input2>>grade[row][colo];
}
}
void write(string name[row]; double grade[row][colo])
{
for(int r=0; r<row; r++)
{
cout<<name[row];
for (int colo; c<colo; c++)
cout<< "\t" << grade[row][colo]<<" ";
}
}
void sum(double grade[row][colo], sum[row])
{
for (int r=0; r<row; r++)
{
for (int c=0; c<colo; c++)
sum[colo] = sum[colo]+G[row][colo];
}
}
void avg(double sum[row], double average[row])
{
for (int r=0; r<row; r++)
average[r]=sum[r]/colo;
}
void letter_grade(double avg[sizerow], char letter S[row])
{
for (int i=0; i < sizerow-1; i++)
if (avg [i] >= 90)
letter[i]='A';
else if (avg [i] >=80)
letter[i]='B';
else if (avg [i] >=70)
letter[i]='C';
else if (avg [i] >=60)
letter[i]='D';
else
avg[i] = 'F';
}
|