Activity 19.8.
Write a program that prompts the user to enter the weight of a letter and that tells the user the postage necessary to mail this letter with the US Postal Service.
Here is a sample output:
How much does your letter weigh (in ounces): 5.5
The postage is 203 cents.
Note: You can start with the code given below. Postage is calculated based on the next higher weight in the chart.
Your program should use a function, to which you pass the two relevant arrays along with their sizes, as well as the weight entered by the user, and which returns the corresponding postage. The final version of your program should use pointer arithmetic.
Does this problem look familiar? You have worked on this before, just not using functions or pointer arithmetic. Below is the code we wrote previously for this problem.
Compile and run the code below in your own C environment.
#include <stdio.h>
#define N 14 /* number of weights in the array */
int main (void) {
float weights[N] = {1, 2, 3, 3.5, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13}; /* weight in ounces */
int stamp[N] = {49, 70, 91, 112, 161, 182, 203, 224, 245,
266, 287, 308, 329, 350}; /* price in cents */
float letter; /* user's letter weight in cents */
printf("How much does your letter weigh (in ounces): ");
scanf("%f", &letter);
/* Your code goes here! */
return 0;
}

