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
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...
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.
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...
Please use Python programming language to write a client program and a server program, so that...
Please use Python programming language to write a client program and a server program, so that these two programs communicate through a TCP connection based on the following scenario: Both of the client program and the server program are running on the same localhost. The client program prompts the user to enter the radius of a circle and pass it to the server program. The server program computes the area of this circle and passes it to the client program....
c++ Write a program that calls a function calculateSum to calculate the sum from -1 to...
c++ Write a program that calls a function calculateSum to calculate the sum from -1 to N. The function calculateSum has one parameter N of type integer and returns an integer which represents the sum from -1 to N, inclusive. Write another function calculateAverage that calculates an average. This function will have two parameters: the sum and the number of items. It returns the average (of type float). The main function should be responsible for all inputs and outputs. Your...
Write the following using C language for program in Arduino: Write a program that turns on...
Write the following using C language for program in Arduino: Write a program that turns on first LED for one second, then first LED off, wait for one second, then second LED turns on for one second, then goes off, wait for one second, keep going for third and fourth LEDs, and the program repeats until power is cut or new program uploaded.
in c++ Write a C++ program that asks the user to enter an integer number and...
in c++ Write a C++ program that asks the user to enter an integer number and prints it back "vertically" to the screen. Use recursion in your solution. As an example of how the program will work: Please enter an integer: 12345 The integer you entered will print vertically as: 1 2 3 4 5
In C programming, Thank you Write a program to compute the area of a circle. You...
In C programming, Thank you Write a program to compute the area of a circle. You have to write a complete “C” program that compiles and runs in Codeblocks. Program requirements: 1. Declare the variables needed: radius (r) and area (yourLastName). 2. Calculate and print the area of each circle. 3. The program MUST prompt the user for a new radius (r) over and over until the user types -1. 5. Use the type double for all decimal numbers. 6....
Using python, write the program below. Program Specifications: You are to write the source code and...
Using python, write the program below. Program Specifications: You are to write the source code and design tool for the following specification: A student enters an assignment score (as a floating-point value). The assignment score must be between 0 and 100. The program will enforce the domain of an assignment score. Once the score has been validated, the program will display the score followed by the appropriate letter grade (assume a 10-point grading scale). The score will be displayed as...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT