Write a program that prompts for and reads in test scores. You may assume that v
ID: 441508 • Letter: W
Question
Write a program that prompts for and reads in test scores. You may assume that valid test scores will be integer values between 0 and 100. You may also assume that the user will not enter more than 35 test scores. Use a preprocessor directive to define this value. User input will be complete when the user enters a -1 for the test score. When all of the test scores have been entered, the program will print out the scores. Use a while or do-while loop to read in the values. Use a for loop to print out the values.Explanation / Answer
include<iostrean.h>
#include<conio.h>
int a[35];
void main()
{
int i=0;
do
{
i++;
cout<<" ENTER TEST SCORE "<< i<<"; ";
cin>>a[i-1];
}while(a[i]>0);
cout<<" NUMBER OF SCORES ENTERED: "<<i;
cout<<" Score entered: ";
for(int j=0;j<i;j++)
cout<<" "<<a[j];
getch();
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.