Answer to Question #256701 in C++ for Dion Martins

Question #256701

Write an algorithm that will accept the following for 100 students: The students’ name (studName) and 3 test marks (marks), as well as one exam mark (examMark). The program must calculate the final mark (finMark) for every student. The final mark comprises of 50% of the exam mark added to 50% of the average (agv) of the 3 tests. Display the final mark for every student.

1. Use a simple for-loop to determine the answer.


1
Expert's answer
2021-11-02T00:39:12-0400
#include<iostream>
using namespace std;
int main(){
	string studName[100];
	double final_mark[100];
	for(int i=0; i<100; i++){
		cout<<"Enter student name:  "<<endl;
		cin>>studName[i];
		
		double test1, test2, test3, exam;
		cout<<"Enter test 1: "<<endl;
		cin>>test1;
		cout<<"Enter test 2: "<<endl;
		cin>>test2;
		cout<<"Enter test 3: "<<endl;
		cin>>test3;
		cout<<"Enter exam mark: "<<endl;
		cin>>exam;
		
		double average = (test1 + test2 + test3) /3;
		final_mark[i] = average * 0.5 + exam * 0.5;
		
	}
	cout<<"Name\tFinal Mark"<<endl;
	for(int i=0; i<100; i++){
		cout<<studName[i]<<"\t\t"<<final_mark[i]<<endl;
	}
}

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS