Using dev C++ please help me; keep it simple and understandable for me pls Write
ID: 3837421 • Letter: U
Question
Using dev C++ please help me; keep it simple and understandable for me pls
Write a program to ask the user to enter 3 test scores and to display the average of the scores (after dropping the lowest score) Dispaly also the corresponding letter grade. Your program should include the 3 functions called Findlowest, FindAverage, and FindLetter. FindLowest - should be called to find and return the lowest of the grade FindAverage should be called to compute the average of the scores. Your program will have to call FindLowest before computing the average. FindLetter will receive the average of the scores and find and return the letter grade. Sample RUN: Enter three test scores for student #1: 80 90 100 After dropping the lowest score your average is ? and your grade is? Enter three test scores for student #2: 50 60 60 After dropping the lowest score your average is and your grade is ? (etc) If two scores are both the lowest, be careful not to accidentally drop two test grades!Explanation / Answer
#include <iostream>
using namespace std;
int min_ele (int ar[])
{
int min = ar[0];
for (int i = 0; i < 3; ++i)
{
if (ar[i] < min)
{
min = ar[i];
}
}
return min;
}
int avg_ele (int ar[])
{
int min = ar[0];
int tot=0;
for (int i = 0; i < 3; ++i)
{
tot+=ar[i];
}
tot=(tot/3);
return tot;
}
char g(char f)
{
int m=(int)f;
if(m<4)
return 'F';
else
if((m<4)&&(m>6))
return 'b';
else
return 'a';
}
int main()
{
int ar [50];
cout<<"Enter the 3 test scores"<<" ";
for(int i=0;i<3;i++)
{
cin>>ar[i];
}
int min = min_ele (ar);
int avg=avg_ele(ar);
avg=avg/10;
char c=(char)avg;
char d=g(c);
cout << "Ater lowet score ur Average : " << avg<<" " <<"Ur GRade is"<<d;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.