C plus plus assignment help service

pointer multiplication c++ example source code

Leave a Comment
Write a program to 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
simple pointer multiplication example c++ code

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:";
 cout<<"Enter 2nd Value:";
 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
c++ simple pointer multiplication example source code

Find more: c++ programming simple examples


Post a Comment