- #ifndef IN2CM_H
- #define IN2CM_H
- #include <stdio.h>
- float convert(int in);
- int get(int i);
- void output(float result);
- #endif
- /***************** END OF HEADER ***********************/
- #include "in2cm.h"
- int main(void)
- {
- int inches = 0;
- float centimeters = 0;
- inches = get(inches);
- centimeters = convert(inches);
- output(centimeters);
- return (0);
- }
- /*************************************
- * FUNCTION: get(int i) *
- * This function accepts input from *
- * stdin and returns the data to the *
- * main(). *
- *************************************/
- int get(int i)
- {
- printf("nEnter your height in inches > ");
- scanf("%d", &i);
- return(i);
- }
- /*************************************
- * FUNCTION: convert(int in) *
- * This function converts the number *
- * of inches to centimeters and then *
- * passes the result to the output(). *
- *************************************/
- float convert(int in)
- {
- float cm = in * 2.54;
- return (cm);
- }
- /*************************************
- * FUNCTION: output(float result) *
- * This function formats the data *
- * from the convert() and displays *
- * the resulting value. *
- *************************************/
- void output(float result)
- {
- printf("nYou are %.2f centimeters tall!nn", result);
- }
- #ifndef IN2CM_H
- #define IN2CM_H
- #include <stdio.h>
- float convert(int in);
- int get(int i);
- void output(float result);
- #endif
- /***************** END OF HEADER ***********************/
- #include "in2cm.h"
- int main(void)
- {
- int inches = 0;
- float centimeters = 0;
- inches = get(inches);
- centimeters = convert(inches);
- output(centimeters);
- return (0);
- }
- /*************************************
- * FUNCTION: get(int i) *
- * This function accepts input from *
- * stdin and returns the data to the *
- * main(). *
- *************************************/
- int get(int i)
- {
- printf("nEnter your height in inches > ");
- scanf("%d", &i);
- return(i);
- }
- /*************************************
- * FUNCTION: convert(int in) *
- * This function converts the number *
- * of inches to centimeters and then *
- * passes the result to the output(). *
- *************************************/
- float convert(int in)
- {
- float cm = in * 2.54;
- return (cm);
- }
- /*************************************
- * FUNCTION: output(float result) *
- * This function formats the data *
- * from the convert() and displays *
- * the resulting value. *
- *************************************/
- void output(float result)
- {
- printf("nYou are %.2f centimeters tall!nn", result);
- }
- /*********************** OUTPUT *************************
- Enter your height in inches > 67
- You are 170.18 centimeters tall!
- *********************************************************/

By: 0_C001 | Date: Sep 11 2006 16:58 | Format: None | Expires: never | Size: 2.96 KB | Hits: 1416
Latest pastes
1 hours ago
2 hours ago
15 hours ago
21 hours ago
1 days ago