Posted by MindBreaker at 8:26 AM
Read our previous post
Object
Pass two
vatiables by reference, assign values after multiplying by two. Show their
values from calling program.
Source code
#include<iostream>
using namespace std;
int
multiplying(int&,int&);
int
multiplying(int&a,int&b)
{
a=a*2;
b=b*2;
return(0);
}
void
main(void)
{
int
n1,n2,result;
cout<<"Enter
the First:";
cin>>n1;
cout<<"Enter
the second:";
cin>>n2;
result=multiplying(n1,n2);
cout<<"the
number is:"<<n1<<endl;
cout<<"the
number is:"<<n2<<endl;
}
Output
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.