Notes on how to do the questions on passing structures to functions (Test 4) 1) write the function name (typically f, or some given required name) 2) write a blank underscore to the left of this name 3) put a pair of parens (with lots of space in between), to the right of the function name 4) read the question carefully to determine how many params are needed put that number minus one, this answer's number of commas in parens 5) carefully put each param in with its type. The type always precedes the variable name. Types can be such as int, char, float, int**, or struct gas Note that if it is a struct, then it needs both words: struct and the required name for that struct. This requirement to say both words is only if the struct is defined in the way shown in class, this would not be used if using typedef. 6) carefully figure out if any of the params are pass by value or pass by reference (pass by reference is also sometimes called the address of something). 7) read carefully several times to ensure that the function header line is completed correctly. 8) Put a pair of open-close braces (with many lines in between them) to contain the function code. 9) declare any obviously needed local variables 10) start to write up the logic that is needed to access the struct components and manipulate any data (such, as filling in new struct components of local variables, or pass by reference params). Ensure that components are accessed by using the period between the variable and the component, e.g., a.part or (*a).part (which could be written as a->part) 11) carefully read the instructions to see what is to be returned and under what logic e.g., return 1, or return 0, or return a (where a is a struct) 12) when you know the type of what is being returned (only one such type can exist in the function) write that type in for note 2 (the blank undersore that is to the left of the function name). 13) if nothing is to be returned by the return statement, then do not put any return statements, and write void in the place for note 12. Finish the steps below by end of Feb 27, 2012 ============================================= 13.1) Continue Food Bank , as follows: if (choice==3) { if (req_count == 0) { message 1 : No hunger } else if (don_count == 0) { message 2 : Scrooges in this town } else { // request does not find a match in donations found = -99; for (i=0; ireq_amt[0]) { don_amt[found] -= req_amt[0]; //reduce the donation table's amount; //remove the request as above for (i=1;i as the first line, and to add the line system("pause"); just before the return statement. Make sure both programs run on your computer. When you run each one, it should produce output on the black screen. 1.3) After you have verified that you can run both programs in 1.2, erase each one, and try to write it yourself without looking at any notes. Get help from the notes to finish each program. Finally, keep repeating 1.3 until you are able to write each program by starting from an empty page and without any help from notes. 1.4) Read Lecture notes, Chapter 2, skipping the Brief Intro to Pointers. 1.5) Understand all the four types of variables in Chap 2. Try writing feettomile.c as floats. Make up additional calculations, such as as computing the amount of tax from a six percent sales tax on a ten dollar purchase. Do these (new) programs with ints and floats. 1.6) Make sure you write programs that have statements such as a++; or a += 10; ensure you understand the meanings of these statements. 1.7) Download feettomile2.c, and learn about the use of scanf. For additional programs that you might have written for 2.1 (such as a sales tax program), modify them to read in most of the quantities, and get expertise using the scanf in a variety of situations.