Write a program to

Prototypes for functions are

**multiply two numbers using pointers**. Make function for multiplication take input from user. There should be three function each should return a different data type int, float and double.Prototypes for functions are

This program has been tested on c++ codeblocks IDE

C++ source code:

see also: pointer addition example source code

#include <iostream> using namespace std; int Mult(int *, int *); float Mult1(int *, int *); double Mult2(int *, int *); int main(){ int a,b; cout<<"Enter 1st Value:"; cin>>a; cout<<"Enter 2nd Value:"; cin>>b; cout<<"...............Multiplication.........." <<endl <<endl; cout<<"The integer Multiplication of these numbers is:"<<Mult(&a,&b)<<endl; cout<<"zThe float Multiplication of these numbers is:"<<Mult1(&a,&b)<<endl; cout<<"The double Multiplication of these numbers is:"<<Mult2(&a,&b)<<endl; cout<<endl <<endl; return 0; } int Mult(int *x, int *y){ int Prod; Prod=(*x * *y); return Prod; } float Mult1(int *x, int *y){ float Prod; Prod=(*x * *y); return Prod; } double Mult2(int *x, int *y){ double Prod; Prod=(*x * *y); return Prod; }

Program input output

Find more: c++ programming simple examples

## 0 comments:

## Post a Comment