-1
#include<iostream>
using namespace std;
class Dist
{
    int feet;
    float inches;
public:
    enter()
    {
        cout<<"\nenter feet ";
        cin>>feet;
        cout<<"\nenter inches";
        cin>>inches;
    }
    display()
    {
        cout<<feet<<"'-"<<inches;
    }
    scale(Dist d1, float scalefactor)
    {
        d1.feet= d1.feet*scalefactor;
        d1.inches=d1.inches*scalefactor;
        while(d1.inches>=12)
            {
                d1.inches=12-d1.inches;
                d1.feet++;
            }

};
main()
{
    Dist d1,d2;
    d1.enter();
    d1.scale(d1,0.5);
    d1.display();

}   //error is in this line

error is in the last line. This code is the solution for the question

Define a class Dist with int feet and float inches. Define member function that displays distance in 1’-2.5” format. Also define member function scale ( ) function that takes object by reference and scale factor in float as an input argument. The function will scale the distance accordingly. For example, 20’-5.5” and Scale Factor is 0.5 then answer is 10’-2.75”

t.niese
  • 39,256
  • 9
  • 74
  • 101
  • 2
    If the tutorial/course you take does not teach you how to properly define a function (that includes a return type), then you should probably think about using some good c++ books instead: [The Definitive C++ Book Guide and List](https://stackoverflow.com/questions/388242) – t.niese Feb 29 '20 at 09:47
  • Your scale method is missing a closing brace – Alan Birtles Feb 29 '20 at 11:25

1 Answers1

1

There no one method return type in your methods. You have to mention method return in declaration.

Like
    void enter()
    void display()
    void scale()

Also for main method
    void main()
Return int value for nain is good
practice.
int main(){ 
    //your code here
    return 0;
}
Jahangir
  • 161
  • 2
  • 7