Question

Write a program in the C ++ language that executes the following application 1-   Type function...

Write a program in the C ++ language that executes the following application

1-   Type function to find grade (a, b, c, d, e, fnil)

2-. Write a program that requires the user to enter student marks

3- Use the function to show the student's mark with grade

Homework Answers

Answer #1

I WROTE THE CODE ALONG WITH THE COMMENTS:

CODE:

#include <iostream>

using namespace std;

char grade(int);

int main()
{
  
//variables declaration.
int i,n;
char value;
  
cout<<"Enter number of students: ";
cin>>n;
int student_marks[n];
cout<<"Enter student marks: ";
for(i=0;i<n;i++) //for loop used to scan the student_marks.
{
cin>>student_marks[i];
}
cout<<endl;
for(i=0;i<n;i++)
{
value=grade(student_marks[i]); //calling the grade function to find the grade based on marks.
cout<<"Grade of student "<<(i+1)<<": "<<value<<endl;
  
}

return 0;
}
char grade(int marks)
{
//Based on marks different grades will be given.
  
if(marks>=80)
{
return 'A';
}
else if(marks<80 && marks>=79)
{
return 'B';
}
else if(marks<79 && marks>=69)
{
return 'C';
}
else if(marks<69 && marks>=59)
{
return 'D';
}
else if(marks<59 &&marks>=49)
{
return 'E';
}
else
{
return 'F';
}
  
}

OUTPUT:

SCREENSHOT OF THE CODE:

EXPLANATION:

I TOOK N STUDENT MARKS AND USING THE FUNCTION TO FIND THE GRADE.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a program in the C ++ language that executes the following application 1- Define an...
Write a program in the C ++ language that executes the following application 1- Define an array consisting of 10 values 2- The user is allowed to enter 10 values 3- Prints the lowest value in the array
Java Language: Write an application that asks the user to enter a student ID and a...
Java Language: Write an application that asks the user to enter a student ID and a test letter grade. Create an Exception class names GradeException that contains an Array of valid grade letters that you can use to determine whether a grade entered from the application is valid. In your application, throw a GradeException if the user does not enter a valid letter grade. Catch the GradeException, and then display an appropriate message. In addition, store an 'I' (for incomplete)...
C - Language Write an expression that executes the loop while the user enters a number...
C - Language Write an expression that executes the loop while the user enters a number greater than or equal to 0. Note: These activities may test code with different test values. This activity will perform three tests, with user input of 9, 5, 2, -1, then with user input of 0, -17, then with user input of -1. Also note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds,...
(C language) <stdio.h> decisions (else if or switch) Write a program to calculate the average of...
(C language) <stdio.h> decisions (else if or switch) Write a program to calculate the average of the 2 highest numbers entered. Ask the user to enter 3 integers, determine which 2 integers are the 2 highest, and then calculate and display the average of the 2 highest numbers. Format the answer to 2 decimal places. The numbers can be entered in any sequence - lowest to highest, highest to lowest, or completely random. A decision block will be necessary to...
Write a program in MIPS ASSEMBLY LANGUAGE.. Take no of students as input from the user,...
Write a program in MIPS ASSEMBLY LANGUAGE.. Take no of students as input from the user, then take marks of 5 subjects for each student from the user. Then find Minimun, Maximum and Median of all the subjects. and comment each line in code also make flow chart
Write C++ program to create a student record include a student ID, first name, nickname, course,...
Write C++ program to create a student record include a student ID, first name, nickname, course, subject, and subject marks. Task: Create a function to insert a number of students in the record. Create a function to print all student information by a table. Create a function to print all student information that they're in a specific course chosen by user input. Create a function to search for a student by student ID and print student information. Create a function...
Write a program (C language) that will read the number of a month and will print...
Write a program (C language) that will read the number of a month and will print the number of days in the month. Ignore leap years. Use 28 days for February. Have the program runs in a continuous loop, allowing the user to enter a month number, see that number of days, and repeat. Use month number = 0 to exit the loop and the program. Program must meet the following criteria: 1.Your name and the name of the program...
Write a program in C to find the student’s eligibility for admission into some academic program....
Write a program in C to find the student’s eligibility for admission into some academic program. Ask the user to enter three grades for Maths, Physics, and Chemistry. Then if: The student’s grade in Math is greater than 80 and in Physics is greater than 70, the student is eligible to study Engineering. The student’s grade in Physics is greater than 80 or Chemistry is greater than 90, the student is eligible to study Sciences. Otherwise, the student is not...
PLEASE USE LOOPS ONLY TO COMPLETE THIS ASSIGNMENT. (Find the three lowest scores) Write a program...
PLEASE USE LOOPS ONLY TO COMPLETE THIS ASSIGNMENT. (Find the three lowest scores) Write a program that prompts the user to enter the number of students and each student’s name and score, and finally displays the student with the lowest score and the student with the second-lowest score and the student with the third lowest score. Program must accept first name only or first and last name SAMPLE RUN #1: java ThreeLowestScores   Enter the number of students:6↵ Student 1 of...
How would I write the following program in C programming language? Function header: int sumsort(int *a,...
How would I write the following program in C programming language? Function header: int sumsort(int *a, int *b, int *c) This function should arrange the 3 values in the memory locations pointed to by a, b, and c in ascending order and also return the sum of the contents of the memory locations a, b, and c.