Solve this in c++ must read question carefully take one value only i think so,,,,,, otherwise you know better need solution urgently............
Write a program that pass two parameters to a function one by value and one by reference. Then check the original values whether their values have been changed or not.
program:
#include <iostream>
using namespace std;
void changeValues(int x, int& y){
x += 5;
y += 5;
}
int main(){
int x = 5, y = 5;
cout<<"Original Values:\n";
cout<<"x = "<<x<<endl;
cout<<"y = "<<y<<endl;
changeValues(x,y);
cout<<"Values after modification:\n";
cout<<"x(passed by value) =
"<<x<<endl;
cout<<"y(passed by reference) =
"<<y<<endl;
return 0;
}
output:
Get Answers For Free
Most questions answered within 1 hours.