So my current code works in Dev C++ but doesn't work in the SSH client (which I'm to understand is Unix). My 2nd to last line of 'cout' is to see what numbers are actually getting added. When in the SSH client val1 registers as 0 so val2 has no subtractions made to it. After that, all the other numbers come in just fine. Any help is appreciated!
#include <iostream>
#include <cmath>
usingnamespace std;
int main()
{
cout<<"Enter a number to find it's sum: ";
int val1;
while(cin>>val1){
int val2 = val1/10000;
cin>>val2;
int val3 = val1/1000-(val2*10);
cin>>val3;
int val4 = val1/100-((val2*100)+(val3*10));
cin>>val4;
int val5 = val1/10-((val2*1000)+(val3*100)+(val4*10));
cin>>val5;
int val6 = val1-((val2*10000)+(val3*1000)+(val4*100)+(val5*10));
cin>>val6;
cout<<val2<<' '<<val3<<' '<<val4<<' '<<val5<<' '<<val6<<'\n';
cout<<val1<<" sum is: "<<val2+val3+val4+val5+val6<<'\n';
}
return 0;
}