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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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