Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

It should be in C-language. Write an update function to allow a user to update a student mark. This function should take in two parameters

It should be in C-language.

image text in transcribedimage text in transcribed

Write an update function to allow a user to update a student mark. This function should take in two parameters (it can take in more parameters, but must take in at least these two: ID-a studentld val-the new mark for that student This function will iterate through the studld array searching for an element which matches ID. If a match is found, then the corresponding position in the marks array will be set to val and the position where the match was found will be returned. If ID is not found, -1 is returned. Hints: Remember that when comparing strings, you need to use the strcmp function. See the names.c example from this weeks workshop to see how to use it. Once you have implemented the update function, add a loop in main0 after the first call to printMarks0. This loop should prompt the user if they would like to update a mark. If the user types 'y' then the program should prompt for the student id and new mark and call If the user types 'n', the program should return. (extension: handle the case of when the user types something other than 'y or 'n'). One warning on scanf. When reading a string, scanf will leave the 'In' (newline) character on the input. If you read another string, then that causes no problems as scanf will read past 'white space' (including ' , tabs, etc) until it gets to a character and read from there. BUT if you read a character instead of a string next, then scanf will read the 'In' as the next character! To avoid this, if you are reading a character after reading a string, use: scanf(" %c"&mychar): Note the extra space in front of the %c. That will cause scanf to skip the' ' and read the next character entered

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

Students also viewed these Databases questions