i'm writing a program to capture marks and names of 15 students and then i'll be using a function to display whether those students have failed,supplement or passed. but the problem is i'm using strings to capture those names and i'm using arrays to capture those names and the marks.i'm really confused right now. i've tried everything i can think of. this is what i did below and any suggestions are welcome
#include<iostream>
using namespace std;
#include<iomanip>
void getInput(char[] ,int&);
void displayResults(char[],int&);
int main()
{
int x;
int MarkP ;
char NameP[15];
for(x=1;x<=15; x++)
{
getInput(NameP,MarkP);
displayResults(NameP,MarkP);
}
return 0;
}
void getInput(char NameP[],int &MarkP)
{
cout<<"Name\t\tMarks\n";
cout<<"Enter the Name of the student\n";
cin>>NameP;
cout<<"\t\t";
cin>>MarkP;
}
void displayResults(char NameP[],int &MarkP)
{
if(MarkP<=39)
cout<<"you failed the course and come next year to repeat\n";
if(MarkP>=40 && MarkP<=49)
cout<<"You may write the supplementary examination\n";
if(MarkP>=50 && MarkP<=74)
cout<<"Congratulations!!You passed the examination\n";
if(MarkP>=75 && MarkP<=100)
cout<<"You passes with a distinction\n";
}