Question
Write a program using "C" in visual studio that:

A. Has a function (input()) that allows the user to enter a list of 10 scores and stores them in an array.

B. Has a function (result()) then assigns grades based on the following sheme:
21 Write a program that a Has a function (iaoutO) that allows the user to enter a list of 10 scores and stores therm in an array b. Has a function (resultil then assigns gracdes besed on the following scheme The grade is A if score is >e best-10 The grade is B is score is> best- 20 The grade is C if score is - best-30 The grade is D if score is >- best-40 Output nter grade or student 1: 92 Enter grade or stadent 2: 83 Enter grade or student 3: 70 Enter grade or student 4: ee Enter grade or student 5: 6 Enter grade or student 6: 70 Enter grade or student 7: 85 Enter arade or student 8: 90 Enter arade or otudent 9: 77 Enter gzade or otodent 20: 69 cores The best score vas 92 rades: he grade tor studen:i A he grade tor studen 2 The gzade tor student c grass tor student. Î A The gzade tor ruden The gzade tor atudsea The
0 0
Add a comment Improve this question Transcribed image text
Answer #1

C Program:

#include <stdio.h>
#include <stdlib.h>

//Function that reads scores from user and stores in array
void input(int scores[])
{
    int i;

    //Iterating over 10 scores
    for(i=0; i<10; i++)
    {
        //Reading scores and storing in array
        printf("\nEnter grade or student %d: ", (i+1));
        scanf("%d", &scores[i]);
    }
}

//Function that finds grades based on score
void result(int scores[], int best)
{
    int i;
    char grade=' ';

    printf("\nGrades:\n");

    //Iterating over 10 scores
    for(i=0; i<10; i++)
    {
        //Calculating grade
        if(scores[i] >= (best - 10))
        {
            grade = 'A';
        }
        else if(scores[i] >= (best - 20))
        {
            grade = 'B';
        }
        else if(scores[i] >= (best - 30))
        {
            grade = 'C';
        }
        else if(scores[i] >= (best - 40))
        {
            grade = 'D';
        }

        //Printing result
        printf("\nThe grade for student %d is %c\n", (i+1), grade);
    }
}

//Main function
int main()
{
    int scores[10];
    int i, bestScore;

    //Calling input() function
    input(scores);

    //Initially assume that best score was starting score
    bestScore=scores[0];

    printf("\n\nScores: \n");

    //Iterating over each score and test for best score
    for(i=0; i<10; i++)
    {
        //Printing score
        printf("%d, ", scores[i]);

        //Checking for best score
        if(scores[i] > bestScore)
        {
            //Updating best score
            bestScore = scores[i];
        }
    }

    printf("\n\nThe best score was %d \n", bestScore);

    //Calling result function
    result(scores, bestScore);

    return 0;
}


____________________________________________________________________________________________

Sample Run:

Enter grade or student 1: 92 Enter grade or student 2: 83 Enter grade or student 3: 70 Enter grade or student 4: 88 Enter gra

Add a comment
Know the answer?
Add Answer to:
Write a program using "C" in visual studio that: A. Has a function (input()) that allows...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • write a program that uses a function to read in the grades for four classes and...

    write a program that uses a function to read in the grades for four classes and then uses a function to calculate the average grade in each of the classes. input the grades for one student. we will name her Beverly. output how Beverly's grade differs from each classe average. Make sure that your output is very clear. Below is your data: English 90 70 85 45 95 95 82 97 99 65 History 63 94 60 76 83 98...

  • Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment...

    Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment as a percentage given the student’s score and total points. The final score must be rounded up to the nearest whole value using the ceil function in the <cmath> header file. You must also display the floating-point result up to 5 decimal places. The input to the program must come from a file containing a single line with the score and total separated by...

  • using java Program: Please read the complete prompt before going into coding. Write a program that...

    using java Program: Please read the complete prompt before going into coding. Write a program that handles the gradebook for the instructor. You must use a 2D array when storing the gradebook. The student ID as well as all grades should be of type int. To make the test process easy, generate the grade with random numbers. For this purpose, create a method that asks the user to enter how many students there are in the classroom. Then, in each...

  • Please help me with this program.You are to write a C++ program that will read in...

    Please help me with this program.You are to write a C++ program that will read in up to 15 students with student information and grades. Your program will compute an average and print out certain reports. Format: The information for each student is on separate lines of input. The first data will be the student�s ID number, next line is the students name, next the students classification, and the last line are the 10 grades where the last grade is...

  • You have been asked to write a program to grade several multiple-choice exams. The exam has...

    You have been asked to write a program to grade several multiple-choice exams. The exam has 20 questions, each answered with a letter in the range of ‘a’ through ‘f’. The answers key is declared in the program as constant of type string. An example of answer key is “abcdefabcdefabcdefab”. Your program should work for any other answer key. The program should first ask users for the number of students to be graded. Then it should have a while loop...

  • I have a C++ code that lets me enter, display and delete a student record. I...

    I have a C++ code that lets me enter, display and delete a student record. I need to implement a function that prints the average grade score of the students I input. Below is my code and a picture of how my code looks right now. #include<iostream> #include<stdlib.h> using namespace std; //Node Declaration struct node {    string name;    string id;    int score;    node *next;   }; //List class class list {        private:        //head...

  • Write a C++ program named, gradeProcessor.cpp, that will do the following tasks: -Print welcome message -Generate...

    Write a C++ program named, gradeProcessor.cpp, that will do the following tasks: -Print welcome message -Generate the number of test scores the user enters; have scores fall into a normal distribution for grades -Display all of the generated scores - no more than 10 per line -Calculate and display the average of all scores -Find and display the number of scores above the overall average (previous output) -Find and display the letter grade that corresponds to the average above (overall...

  • using linux terminal NEW YORK CITY COLLEGE OF TECHNOLOGY THE CITY UNIVERSITY OF NEW YORK Department...

    using linux terminal NEW YORK CITY COLLEGE OF TECHNOLOGY THE CITY UNIVERSITY OF NEW YORK Department of Computer Engineering Technology 300 Jay Street, Brooklyn, NY 11201-1909 EMT 2390L - Lab 6 Instructions: Create a new script and name it lab6. Include the following in your script: 1- A global variable named course with "EMT 2390L" assigned to it as default value. 2- A global variable named score that will store a number between 0 and 100. 3. A global variable...

  • Your assignment is to write a grade book for a teacher. The teacher has a text file, which includ...

    Your assignment is to write a grade book for a teacher. The teacher has a text file, which includes student's names, and students test grades. There are four test scores for each student. Here is an example of such a file: Count: 5 Sally 78.0 84.0 79.0 86.0 Rachel 68.0 76.0 87.0 76.0 Melba 87.0 78.0 98.0 88.0 Grace 76.0 67.0 89.0 0.0 Lisa 68.0 76.0 65.0 87.0 The first line of the file will indicate the number of students...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT