I have to increment the value assigned to portb depending on the value of the third command line arguement by the value of the second command line argument.
e.g. labtest -5 3
This will decrement portb by -5, 3 times
EDIT: The value had to also wrap around to 0 and continue with the operation after reaching 255, as well as wrapping around back to 255 after reaching 0
e.g.
if the increment value is 10 and was incremented 3 times and the current value of portb is 238 then the output would be
248
3
13
This is my attempt at a code below
1 2 3 4 5 6 7 8 9 10 11
int portb = 0;
int x = atoi(argv[1]);
int y = atoi(argv[2]);
for (y; y > 0; y--);
{
portb = portb + x;
cout << "This was read from portb = " << portb << endl;
}
Ahh I forgot to mention that the value had to wrap around to 0 once it reached a value of over 255, also that if the value reached 0, it had to wrap around back to 255
It doesn't when I run it. So I expect your code is wrong. Sadly, I can't see your monitor, so it's going to be hard to tell you exactly what mistake you made.