[Previous Homework] [Next Homework]

hw06 - Functions


From Linux on the GL machine:
  • Write a C program (see below) and save it in a file called meters.c in your ./cmsc104/hw06 directory

  • Compile the program:
    gcc -o meters meters.c

  • Run the program to make sure it works:
    ./meters

  • Use the SUBMIT utility turn in the homework.
    submit cs104_grasso hw06 meters.c meters


Using the kilometers.c code as a template, create a program that does the following:
  • Create a function that does the following:
    • Prompt the user to enter a distance in yards
    • Echo the value back to the user
    • Convert that value to it's equivalent in meters
    • Display the converted distance to the user.
  • Call the function from main


Make sure that you follow all the coding standards