HOME Forums Forum Return Function

This topic contains 1 reply, has 1 voice, and was last updated by  Chheang Sopheaktra 1 year, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #918 Reply

    RaksmeyChea

    Can u write one function that can be sum,minus,multiply and divide?

    #919 Reply

    Chheang Sopheaktra
    #include<iostream.h>
    #include<conio.h>
    void calculator(int a, int b)
    {
    	cout<<"A + B = "<<a+b<<endl;
    	cout<<"A - B = "<<a-b<<endl;
    	cout<<"A x B = "<<a*b<<endl;
    	cout<<"A / B = "<<a/b<<endl;
    }
    
    void main()
    {
    	int a,b;
    	cout<<"Input A : "; cin>>a;
    	cout<<"Input B : "; cin>>b;
    	calculator(a, b);
       getch();
    }
    
Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Return Function
Your information: