Inline Function (Intake 41 section 4)

Question

Simple Program for Inline Function Algorithm/Steps:

  • Step 1: Start the program.
  • Step 2: Declare the class.
  • Step 3: Declare and define the inline function for multiplication and cube.
  • Step 4: Declare the class object and variables.
  • Step 5: Read two values.
  • Step 6: Call the multiplication and cubic functions using class objects.
  • Step 7: Return the values.
  • Step 8: Display.
  • Step 9: Stop the program.

Complete the steps and submit your program.

in progress 1
Ask me anything 1 month 16 Answers 154 views 0

Answers ( 16 )

  1. Name: Tamanna Tasnim
    ID: 142

    #include <iostream>
    using namespace std;
    class operation
    {
    int a,b;
    public:
    void get();
    void multiplication();
    void cube();
    };
    inline void operation :: get()
    {
    cout << “Enter first value:”;
    cin >> a;
    cout << “Enter second value:”;
    cin >> b;
    }

    inline void operation :: multiplication()
    {
    cout << “nMultiplication of two numbers: ” << a*b << “n”;
    }

    inline void operation ::cube()
    {
    cout<<“nCube of first number is: “<<a*a*a<<“n” ;

    cout<<“nCube of second number is: “<<b*b*b<<“n” ;
    }

    int main()
    {
    operation obj;
    obj.get();
    obj.multiplication();
    obj.cube();
    return 0;
    }

  2. Md.Muntasir Mamun

    Id.!8192103179

    #include <iostream>
    using namespace std;
    class operation
    {
    int a,b;
    public:
    void get();
    void multiplication();
    void cube();
    };
    inline void operation :: get()
    {
    cout << “Enter first value:”;
    cin >> a;
    cout << “Enter second value:”;
    cin >> b;
    }

    inline void operation :: multiplication()
    {
    cout << “nMultiplication of two numbers: ” << a*b << “n”;
    }

    inline void operation ::cube()
    {
    cout<<“nCube of first number is: “<<a*a*a<<“n” ;

    cout<<“nCube of second number is: “<<b*b*b<<“n” ;
    }

    int main()
    {
    operation obj;
    obj.get();
    obj.multiplication();
    obj.cube();
    return 0;
    }

  3. Name : Moinul islam

    ID : 18192103180

     

     

    #include<iostream>
    #include<conio.h>
    using namespace std;
    class line
    {
    public:
    inline float mul(float x,float y)
    {
    return(x*y);
    }
    inline float cube(float x)
    {
    return(x*x*x);
    }
    };
    int main(){
    line obj;
    float a,b;
    cout << “enter two number : “;
    cin >> a >> b;
    cout<<“Multiplication value is: “;
    cout<< obj.mul(a,b)<< endl;
    cout<<“Cube value of first number is: “;
    cout<<obj.cube(a)<< endl;
    cout<< “cube value of second number :”;
    cout << obj.cube(b);
    getch();
    }

  4. Name:Md.Emon Ali

    id:154

    #include<iostream>
    using namespace std;
    class one
    {
    public:
    int multiplication(int a,int b)
    {

    return a*b;

    }
    int cube(int c)
    {

    return c*c*c;

    }
    };

    int main()
    {
    int x,y,z;
    one ob1;
    one ob2;

    cin>>x>>y;
    cout<<“Multiplication is “<<ob1.multiplication(x,y)<<endl;
    cout<<“cube is “<<ob2.cube(x)<<” and “<<ob2.cube(y);

    }

  5. Name:Nigar Sultana Era

    Id:175

    #include<iostream>
    #include<conio.h>
    using namespace std;
    class line
    {
    public:
    inline float mul(float x,float y)
    {
    return(x*y);
    }
    inline float cube(float x)
    {
    return(x*x*x);
    }
    };
    int main(){
    line obj;
    float a,b;
    cout << “enter two number : “;
    cin >> a >> b;
    cout<<“Multiplication value is: “;
    cout<< obj.mul(a,b)<< endl;
    cout<<“Cube value of first number is: “;
    cout<<obj.cube(a)<< endl;
    cout<< “cube value of second number :”;
    cout << obj.cube(b);
    getch();
    }

  6. Name:Tabassum Mehrin Prova

    ID:177

    #include<iostream>
    #include<conio.h>
    using namespace std;
    class line
    {
    public:
    inline float mul(float x,float y)
    {
    return(x*y);
    }
    inline float cube(float x)
    {
    return(x*x*x);
    }
    };
    int main(){
    line obj;
    float a,b;
    cout << “enter two number : “;
    cin >> a >> b;
    cout<<“Multiplication value is: “;
    cout<< obj.mul(a,b)<< endl;
    cout<<“Cube value of first number is: “;
    cout<<obj.cube(a)<< endl;
    cout<< “cube value of second number :”;
    cout << obj.cube(b);
    getch();
    }

    • Name:Sanjara
    • Id:166

     

    • #include<iostream>
    • using namespace  std;
    • class task
    • {
    • public:
    • inline int mul(int x,int y);
    • inline int cube(int x);
    • };
    • int main()
    • {
    • task.obj;
    • int x=10;
    • int y=20;
    • cout<<obj.mul(int x,int y) <<endl;
    • cout<<obj.cube(int x);
    • cout<<“Multiplication is : “<<a<<endl;
    • cout<<” Cube is : “<<b;
    • return 0;
    • }
    • inline int mul(int x,int y)
    • {
    • return a=(x*y);
    • }
    • inline int cube(int x)
    • {
    • return b= (x*x*x);
    • }

     

  7. Name: Rakibul Hasan Shafin

    ID: 18192103165

    Intake: 41

    Section: 04

    #include <iostream>
    using namespace std;
    class operation
    {
    int a,b;
    public:
    void get();
    void multiplication();
    void cube();
    };
    inline void operation :: get()
    {
    cout << “Enter first value:”;
    cin >> a;
    cout << “Enter second value:”;
    cin >> b;
    }

    inline void operation :: multiplication()
    {
    cout << “nMultiplication of two numbers: ” << a*b << “n”;
    }

    inline void operation ::cube()
    {
    cout<<“nCube of first number is: “<<a*a*a<<“n” ;

    cout<<“nCube of second number is: “<<b*b*b<<“n” ;
    }

    int main()
    {
    operation obj;
    obj.get();
    obj.multiplication();
    obj.cube();
    return 0;
    }

  8. Name: Arman Hossain

    Id: 18192103156

    #include<iostream>
    using namespace std;
    class one
    {
    public:
    int multiplication(int a,int b)
    {

    return a*b;

    }
    int cube(int c)
    {

    return c*c*c;

    }
    };

    int main()
    {
    int x,y,z;
    one ob1;
    one ob2;

    cin>>x>>y;
    cout<<“Multiplication is “<<ob1.multiplication(x,y)<<endl;
    cout<<“cube is “<<ob2.cube(x)<<” and “<<ob2.cube(y);

    }

  9. ID:18192103149
    Intake:41
    Section:04

    #include<iostream>
    using namespace std;
    class one
    {
    public:
    int multiplication(int a,int b)
    {

    return a*b;

    }
    int cube(int c)
    {

    return c*c*c;

    }
    };

    int main()
    {
    int x,y,z;
    one ob1;
    one ob2;

    cin>>x>>y;
    cout<<“Multiplication is “<<ob1.multiplication(x,y)<<endl;
    cout<<“cube is “<<ob2.cube(x)<<” and “<<ob2.cube(y);

    }

  10. Name:Shamima Akter Shimu Id:18192103144

    #include<iostream>
    using namespace std;
    class one
    {
    public:
    int multiplication(int a,int b)
    {

    return a*b;

    }
    int cube(int c)
    {

    return c*c*c;

    }
    };

    int main()
    {
    int x,y,z;
    one ob1;
    one ob2;

    cin>>x>>y;
    cout<<“Multiplication is “<<ob1.multiplication(x,y)<<endl;
    cout<<“cube is “<<ob2.cube(x)<<” and “<<ob2.cube(y);

    }

  11. Ques – For the given class what are the names of its constructor and destructor. show the value of x,y

    ANS :

    there are some error. Help me out …..
    #include <iostream>
    using namespace std ;
    class widgit {

    int x,y;
    public :
    widgit (int a , int b);
    void show();

    };
    widgit :: widgit (int a , int b)
    {
    cout<< “The two values are : ” ;
    x=a;
    y=b;
    a=10;
    b=20;

    }
    void widgit ::show(int a , int b )
    {
    cout<< a;
    cout<< b;
    }

    int main ()
    {
    widgit obj1,obj2;
    obj.show (int  a);
    obj.show ( int  b);
    return 0 ;
    }

  12. Arup Raton Chowdhury

    Id: 18192103155

    #include<iostream>
    using namespace std;
    class one
    {
    public:
    int multiplication(int a,int b)
    {

    return a*b;

    }
    int cube(int c)
    {

    return c*c*c;

    }
    };

    int main()
    {
    int x,y,z;
    one ob1;
    one ob2;

    cin>>x>>y;
    cout<<“Multiplication is “<<ob1.multiplication(x,y)<<endl;
    cout<<“cube is “<<ob2.cube(x)<<” and “<<ob2.cube(y);

    }

  13. Sorry it a private answer.

  14. MD Ashraful Hossain
    Section-4
    ID-18192103137

    #include
    using namespace std;
    class one
    {
    public:
    int multiplication(int a,int b)
    {
    return a*b;
    }
    int cube(int c)
    {
    return c*c*c;
    }
    };
    int main()
    {
    int x,y,z;
    one ob1;
    one ob2;
    cin>>x>>y;
    cout<<“Multiplication is “<<ob1.multiplication(x,y)<<endl;
    cout<<“cube is “<<ob2.cube(x)<<” and “<<ob2.cube(y);
    }

  15. D.k.shah Alam
    id.1819210376

    #include
    using namespace std;
    class my{
    public:
    inline int cube(int s)
    {
    return s*s*s;
    }
    inline int mul(int a,int b)
    {
    return a*b;
    }

    };
    int main()
    {
    my obj;

    int i,j;
    i=obj.cube(3);
    j=obj.mul(2,3);
    cout<<"Cube is = "<<i<<endl;
    cout<<"Multiplication is= "<<j<<endl;
    return 0;
    }

Leave an answer