Function receives a float and an int from main ( ), and product of these two Numbers
Object: : Write a function that receives a float and an int from main ( ), finds the product of these two and returns the product which is printed through main ( ). C++ projects for beginners with source code
Code:
#include<iostream>
#include<conio.h>
using namespace std;
float prod(float a, int b);
void main()
{
float num1;
int num2;
cout<<“Enter Decimal value: “;
cin>>num1;
cout<<“Enter Integer value: “;
cin>>num2;
cout<<“Product of Two Numbers is: “<<prod(num1,num2);
getch();
}
float prod(float a, int b)
{
float pro;
pro=a*b;
return pro;
}
#include<iostream> #include<conio.h> using namespace std; float prod(float a, int b); void main() { float num1; int num2; cout<<"Enter Decimal value: "; cin>>num1; cout<<"Enter Integer value: "; cin>>num2; cout<<"Product of Two Numbers is: "<<prod(num1,num2); getch(); } float prod(float a, int b) { float pro; pro=a*b; return pro; }
Some really wonderful work on behalf of the owner of this site, utterly outstanding subject matter.