Answer to Question #298408 in C++ for nnjd

Question #298408

Write a C++ program that would input 10


scores and output the Highest and Lowest score

1
Expert's answer
2022-02-16T10:21:29-0500
#include <iostream>




using namespace std;


int main()
{
	int score=0;
	int highestScore=0;
	int lowestScore=100000;
	for (int i=0;i<10;i++){
		cout<<"Enter a score "<<(i+1)<<": ";
		cin>>score;
		if(score>highestScore){
			highestScore=score;
		}
		if(score<lowestScore){
			lowestScore=score;
		}
	}
	cout<<"The lowest score: "<<lowestScore<<"\n";
	cout<<"The highest score: "<<highestScore<<"\n";
	system("pause");
	return 0;
}

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