ÿ=0xFF?Code:char buf="ÿ";
how would i see what it was in hex and visa versa
ÿ=0xFF?Code:char buf="ÿ";
how would i see what it was in hex and visa versa
Code:#include <iostream> #include <iomanip> int main(void){ std::cout << std::hex; for(int i = 32;i < 128;i++){ std::cout << "As Hex - 0x" << i << " "; std::cout << "As Char - " << static_cast<char>(i); std::cout << std::endl; } }
EDIT: *points down*
Last edited by BMJ; 10-23-2002 at 12:45 PM.
the 2nd way works best for my prog but has errors
edit: ah! fordy's header fixed it
But it just outputs what the oringal char was
Last edited by krappykoder; 10-23-2002 at 12:45 PM.
You may like this better:There.....Code:#include <iostream> int main () { char c = 'ÿ'; std::cout.flags(std::ios_base::hex | std::ios_base::showbase); std::cout << int(c); return 0; }
Last edited by BMJ; 10-23-2002 at 12:46 PM.
::ios_base undeclared
parse error before ::
1) Did you copy and paste the code?
2) Which compiler/IDE?
Y would it have mattered if i copy pasted?
dev4
To make sure you didn't make a typo
I don't understand... it should work!
the errors are both on line 6 btw lol
I was just wandering when can i change my title lol
I'm aware it is in line 6... but I don't understand how ios_base could be undeclared unless you did not #include <iostream>
(you need 400 posts to change your title - this should not be a motive to spam )
I tryed not including it to see if the erorrs were diff and it bails so it must have included it
slight error: int main ()
look closely
ill test it out now
ios_base is a class in the namespace STD... therefore if you are getting that ios_base is undeclared, I would say that you are doing this:Instead of what it should be - this:Code:#include <iostream.h>Code:#include <iostream>
tryed both lol