Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a C programming problem. Below is the file from exercise F: #include #include int get_int_or_die(void); // REQUIRES: // User has been prompted to

This is a C programming problem.

image text in transcribed

image text in transcribed

Below is the file from exercise F:

#include  #include  int get_int_or_die(void); // REQUIRES: // User has been prompted to enter an int. // PROMISES: // Function tries to read an int using scanf and "%d" // On success, that int is echoed to the user, // and the int is the function return value. // On failure, and error message is printed and // exit is called with an argument of 1. double get_double_or_die(void); // Like get_int_or_die, but tries to read a double using "%lf". int main(void) { int i; printf("Testing get_int_or_die. Please enter a line of text ... "); i = get_int_or_die(); printf("get int_or_die returned a value of %d. ", i); return 0; } int get_int_or_die(void) { int result; if (1 != scanf("%d", &result)) { printf("I could not read an int. I am quitting. "); exit(1); } printf("I read an int value of %d. ", result); return result; }

Exercise G: Writing a complete program What to Do The program you will write here will be a simple utility for a long-distance runner The input will be a distance and a time, and the output will be the average times taken per kilometre and per mile. Write a program that asks a user for a distance in kilometres, as a double, and a time interval, as an int and a double: a number of minutes, and a number of seconds. If the program succeeds in reading all three numbers, it should report the output specified above Here is a sample of a successful dialogue with the program, with slanted typewriter font used to show what was typed by a user

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

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions