Ok i am having trouble getting my code to not output a - number. such as inputting -1234 and it will output 1 2 3 4 with no negative. I have to to where it will space them out but can't figure out where or how to make it not output the -.
Ok i know this is very ugly but i might be getting somewhere. but it will not recognize numbers only symbols. it will add them up but its adding the symbol values not the digits.
ok great looks good, now if i wanted to make that also add them up after it has split them up. i would make just another if statement after the return right.
or could i use this right after the cout on the if statment
1 2 3 4
sum = ch[0]+ch[1]+ch[2]+ch[3];
cout << "The sum of the numbers is:" << sum << endl;
}
The ASCII value of '0', is 48, '1' is 49, etc. So, to get the sum, which is an int, to get the value of the number, would be to subtract the ASCII value of it.
ok got it, so if i wanted to add more numbers i could just up that 192 and then subtract it at the end with each number added. Makes sense thanks for explaining that to me and not just showing. it helps alot to have both, thanks so much i'll keep playing and adding to this