The question I have to answer is to find out the average marks between two students. These students are:
studentID: P1001 mark: 78.5
studentID: P1002 mark: 66
I am using arrays to store these records. My declarations are as follows:
int menu;
xxxxx studentID[] = {"P1001", "P1002"};
float studentMark[] = {78.50, 66};
int i=0;
int j;
int totalStudents=0;
float totalMarks=0;
float averageMark;
*xxxxx indicates the data type. HOWEVER I do not know what data type to use as it consist both int and char. I have tried using these data types as well as void, but I continue getting an error.
My other question is, how can I find the total number of students so that I can use it to calculate the average. Obviously I know that the total is 2, but I will lose marks if I just enter 2 by default. I have found a solution to calculate the total marks but I just cant seem to come across the number of total students.
Heres is what my full coding looks like at the moment:
#include <iostream>
using namespace std;
int main()
{
int menu;
studentID[] = {"P1001", "P1002"};
float studentMark[] = {78.50, 66};
int i=0;
int j;
int totalStudents=0;
float totalMarks=0;
float averageMark;