There are a lot of problems with your code.
First there is no iostrem.h
. After correcting this to iostream.h
g++ will give a fatal error: iostream.h: No such file or directory
because the standard libraries must not be included with .h
Changing it to #include <iostream>
results in the error: 'cout' was not declared in this scope
. You need std::cout << a
to make it compile successfully.
But even after resolving all the above problems, an important thing was output by gcc with -Wall -Wextra -pedantic
option
warning: comparison is always true due to limited range of data type
That's because 256 is outside unsigned char
's typical range. It only works if char has more than 8 bits, which is not the case of your platform. You should always enable all compiler warnings. That'll help you identify a lot of problems without the need to ask here.
Nevertheless, don't use types less than int
for temporary values unless very necessary because they all will be promoted to int
in expressions anyway.