90 038
Assignments Done
99.7%
Successfully Done
In September 2020

Answer to Question #50326 in C++ for John

Question #50326
Write a program that can enter marks for number of students and calculate their Total and class
average with the following format
The inputs:
ID (As 1 dimension array of Integers),marks(as 2 dimensional array of double), Grad (As 1 dimension
array of Chars)
The Grades are: A for 90’s, B for 80’s, C for 70’s, D for 60’s and F for less than 60.
Use the following functions to find
1. void inputID(int[]);
2. void inputMarks(double [][4]);
3. void Total(double[][4]);
5. double ClassAverage(double[][4]);
6. void print(int[],double[][4],char[]);

The output:
St_Nm ID First Second Final Total Grade
1 20071156 15.5 16.5 30.1 62.1 D
2 20071154 15.0 16.5 30.1 62.6 D

Class average for 10 students is: 72.5
1
2015-01-09T01:15:01-0500
//Question #50326, Programming, C++
#include <iostream>
#include <conio.h>
using namespace std;
int n; // general number of students
//function prototypes
void inputID(int[]);
void inputMarks(double [][4]);
void Total(double[][4]);
double ClassAverage(double[][4]);
void print(int[],double[][4],char[]);
void inputID(int idArray[]) {
cout << "Enter id's of students :\n";
for (int i = 0; i < n; i++) {
cin >> idArray[i];
}
}
void inputMarks(double marks[][4]) {
for (int i = 0; i < n; i++) {
cout << "Enter first, second and final marks for " << i + 1 << " student:\n";
cin >> marks[i][0] >> marks[i][1] >> marks[i][2];
}
}
void Total(double marks[][4]) {
for (int i = 0; i < n; i++) {
marks[i][3] = marks[i][0] + marks[i][1] + marks[i][2];
}
}
for (int i = 0; i < n; i++) {
if (marks[i][3] < 60) {
continue;
}
if (marks[i][3] >= 60 && marks[i][3] < 70) {
continue;
}
if (marks[i][3] >= 70 && marks[i][3] < 80) {
continue;
}
if (marks[i][3] >= 80 && marks[i][3] < 90) {
continue;
}
if (marks[i][3] >= 90) {
continue;
}
}
}
double ClassAverage(double marks[][4]) {
double average = 0;
for (int i = 0; i < n; i++) {
average += marks[i][3];
}
return (average / n);
}
void print(int idArray[], double marks[][4], char grade[]) {
for (int i = 0; i < n; i++) {
cout << i + 1 << "\t" << idArray[i] << "\t" << marks[i][0] << "\t" << marks[i][1] << "\t" << marks[i][2] << "\t" << marks[i][3] << "\t" << grade[i] << endl;
}
cout << endl;
cout << endl;
cout << "Class average for " << n <<" students is: " << ClassAverage(marks) << endl;;
}
void main() {

cout << "Enter general number of students:\n";
cin >> n;
cout << endl;
int *idArray = new int[n];
inputID(idArray);
double marks[100][4];
inputMarks(marks);
Total(marks);
_getch();
}
﻿

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!