Reply to Re: Help With Programming
If you don't have an account, just leave the password field blank.
It's been a while since I've programmed anything (and I know C++ instead of C), so I'll answer these questions to the best of my ability and what I recall:
1) Considering modulus works with remainders from division, it can *only* be used when all inputs and outputs are int (you can't get remainders from operators that have decimal points).
2) I don't quite have the knowledge of C to be able to understand what you're trying to do in the code, but here's how I would approach the problem:
I would likely stick with the same # of variables, but would create a separate int function for converting characters into their ASCII int values (you can't just add two characters together and have them come out as an int). It would something like this:
So, instead of c = a + b, it would look something like this:
Followed by however you display stuff using C.
This, of course, assumes that you already don't have an available function for converting ASCII char to int... in which case, I would ask why you are even asking this question?
1) Considering modulus works with remainders from division, it can *only* be used when all inputs and outputs are int (you can't get remainders from operators that have decimal points).
2) I don't quite have the knowledge of C to be able to understand what you're trying to do in the code, but here's how I would approach the problem:
I would likely stick with the same # of variables, but would create a separate int function for converting characters into their ASCII int values (you can't just add two characters together and have them come out as an int). It would something like this:
int ascii_convert(char character) { int result; //code to convert character to int value goes here return result; }
So, instead of c = a + b, it would look something like this:
c = ascii_convert(a) + ascii_convert(b);
Followed by however you display stuff using C.
This, of course, assumes that you already don't have an available function for converting ASCII char to int... in which case, I would ask why you are even asking this question?