Modify the below code from so that it uses custom functions

Assignment Help Computer Engineering
Reference no: EM132100066

Please read entire post

Part 1 :

Modify the code below so that it uses heap memory to store percentage grades in the range from 0 to 100 (inclusive). The program should allow the user to indicate when he or she is done entering grades (since the user may not have grades to fill the whole array).

When the user is done entering grades, the program should print out the grades entered by the user. Be sure to free the head memory before the program ends.

Part 2:

Modify the below code from so that it uses custom functions to add grades to the array, print the grades entered, calculate the average grade (arithmetic mean, not letter grade), and report the highest and lowest grade entered. This version of the program does not need to use heap memory, though you are welcome to do so.

The program should allow the user to indicate when he or she is done entering grades (since the user may not have grades to fill the whole array).

When the user is done entering grades, the program should print out the grades entered by the user. The program should also display the average grade, highest grade, and lowest grade.

#include "stdio.h"

int main(void)

{

//initialize array

int arr[100];

//initialize variables

int i=0, j=0, n=0;

//infinite loop which will stop when user enters -1

while(n != -1)

{

printf("Enter percentage grade(0-100). Enter -1 to stop: ");

//read grade

scanf("%d",&n);

//if user entered grade is not -1

if(n != -1)

{

//save it to array

arr[i++] = n;

}

//if user entered -1, then exit this loop

else

{

break;

}

}

printf("\n\nThe grades are: \n");

//loop which will iterate till no:of user entered grades

for(j=0; j

{

//print the grade

printf("%d ",arr[j]);

}

return 0;

}

Reference no: EM132100066

Questions Cloud

Which style guide do they prefer to use and why : What differentiated those styles from these styles? What are the pros and cons of each style? Which style guide do they prefer to use and why ?
Research and evaluate three eims software application : Research and evaluate three EIMS software application packages for each of the three Core enterprise management functions: CRM, ERP, and SCM.
The software development of a large scale project : When setting up your team for software development of a large scale project, it is important to get the right number of people from each functional area.
A mobile application that allows customers to reserve tables : You would recommend the Prototype engineering software life cycle model to create a mobile application that allows customers to reserve tables.
Modify the below code from so that it uses custom functions : Modify the code below so that it uses heap memory to store percentage grades in the range from 0 to 100 (inclusive).
Write a c program to accept two integer values : Write a C program to accept two integer values from a terminal screen and print their summation and their difference to a terminal screen.
Research how windows virtual memory has changed : Research how Windows virtual memory has changed over the years. Cover at least 3 versions of Windows .
Parkinson disease and multiple sclerosis : What are some of the differences between Parkinson's Disease and Multiple Sclerosis?
Parkinson disease and multiple sclerosis : What are some of the differences between Parkinson's Disease and Multiple Sclerosis?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Plan a simple system, than draw a context data

however your friends tease you about it, you are an unabashed collector of vintage folk songs from the 1950's and 1960's. Your collection now totals several thousand recordings in various formats. To help keep better track of the recordings

  Calculate the momentum thickness of the boundary layer

A nuclear rocket nozzle of circular cross section has the geometry shown in Fig. The working fluid is helium, and the stagnation pressure and temperature.

  How does the surface temperature vary

Let air at a constant velocity of 15mis, a temperature of 300°C, and 1 atm pressure flow along a smooth, flat surface. Let the first 15 cm of the surface.

  Translate following c++ program to pep/8 assembly language

Translate following C++ program to Pep/8 assembly language

  Devise wild-card patterns to match all filenames

Devise wild-card patterns to match all filenames comprising at least three character. Where the first character is numeric and last character is not alphabetic.

  Find suitable black-box test data for each of given function

Find suitable black-box test data for each of the function that returns the largest of its three parameters, which are floating-point numbers.

  Define the divide-and-average algorithm

The divide-and-average algorithm for approximating the square root of any positive number a is as follows: Take any initial approximation x that is positive, and then find out a new approximation by calculating the average of x and a/x, that is, (..

  Explain why you think the impact will or will not occur

Based on this description, the group should develop an analysis of the impacts such a development would have on one of the following: corporate sales and marketing, manufacturing, or management consulting.

  Compare the resulting postfix expression

For every postfix expression there exists a corresponding and uniquely express infix expression that evaluates to the same number. The converse is not true.

  Explain the principles of siem

Topic: Identify And Describe SIEM Content: Each suggested topic below should be a Heading 2 paragraph (you should have at least 6 topics)

  Weaknesses of both virtualization and cloud computing

Review the literature and analyze the strengths and weaknesses of both virtualization and cloud computing in providing secure and trusted systems

  You can easily and quickly deploy applications via a gui

1.you can easily and quickly deploy applications via a gui interface and push via a browser. historically many

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd