Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8827719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:26:20+00:00 2026-06-14T07:26:20+00:00

I am writing a program that executes two operations on a structure distanceType which

  • 0

I am writing a program that executes two operations on a structure distanceType which is compose of three integer members: feet, yards, and miles.The function convertYards takes a distance in yards that is greater than or equal to 1760 (because there are 1760 yards in a mile) and converts it to x miles, y yards, and z feet (i.e. distanceType). I’m having trouble with the function parameters. convertYards takes in one integer value and returns a distanceType. The problem is I am not sure how to define the function. Since it can accept either distance1 or distance2 (integer values), a small part of the code is below, the area with the “???” is what I am confused about.

struct distanceType
{
  int miles;
  int yards;
  int feet;
}

distanceType convertYards(int ???)  //Define convertYards

Any help is appreciated, thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:26:21+00:00Added an answer on June 14, 2026 at 7:26 am

    So something like the following code which has not been compiled so may need some changes but should capture the essence.

    struct distanceType
    {
      int miles;
      int yards;
      int feet;
    }
    
    distanceType convertYards(int nYards)
    {
        distanceType distance;
    
        distance.miles = nYards / 1760;
        distance.yards = nYards - distance.miles * 1760;
        distance.feet = 0;   // since value is integer number of yards, feet is always zero
        return distance;
    }
    

    This this function would be used as follows:

    int main ()
    {
       distanceType dt1, dt2;
       int          y1 = 3500, y2 = 5700;
    
       dt1 = convertYards (y1);
       dt2 = convertYards (y2);
    
       printf (" %d yards = %d miles, %d yards, and %d feet", y1, dt1.miles, dt1.yards, dt1.feet);
       printf (" %d yards = %d miles, %d yards, and %d feet", y2, dt2.miles, dt2.yards, dt2.feet);
       return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a Visual C# program that executes a continuous loop of operations
I am writing a program that executes a set of tasks sequentially. Each task
I'm writing a program which has two main phases: determining the region of interest,
I'm writing a program that executes different sql statements(query, dml, ddl, dcl). How can
From my previous question here I was writing a program that executes A number
Im writing a program that should read input via stdin, so I have the
I'm writing a program that handles DBs and writes any changes into ListView for
I'm writing a program that's parsing an XML file to java objects using smooks.
I'm writing a program that reads huge file (3x280 GB) and does a fitting
I am writing a program that permutes a list of names based on a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.