uppercase to lower

What's wrong with this simple line of code
 
  cout<<("%c","a"-32)<<endl;
closed account (E0p9LyTq)
C++ std::cout is not C printf(). std::cout doesn't use output format strings.
even when i did
 
 cout<<"a"-32<<endl;



it gave me the same results
"a" is a string literal which degenerates into a pointer-to-const-char. You are not subtracting 32 from the character 'a'. You are subtracting 32 from the address where the nul-terminated string "a" is stored.

cout << (char)('a' - 32) << '\n' ;

Single and double quotes mean different things in C++.
thank you
Topic archived. No new replies allowed.