I am having problems with getting my program to work, I know that int num is not getting into the various three digits I have set up in my function.
#include<iostream>
using namespace std;
void BreakUp (int &uno, int &dos, int &tres, int num){
//Break Up The Number
uno=num/100;
dos=(num%10)/10;
tres=num/10;
}
int Build (int un, int du, int twa){
//Return Value with the digits from Number
int build;
build=((un*100) + (du*10) + (twa));
return(build);
}
int main(){
int num, one, two, three, build; one=0;
two=0;
three=0;
cout<<"enter a number ";
cin>>num;
build=num;
BreakUp(one, two, three, num);
if (num!=Build(one, two, three))
cout<<"ERROR: original and rebuilt numbers do not match"<<endl;
return(0);
}
exactly how i explained it. When you pass by reference you are passing the actual memory location. When you pass by value it works with the value, and not the memory location.