search

Home  >  Q&A  >  body text

c++中反斜杠'\'的问题

#include <iostream>

using namespace std;

int main()
{
    cout << (int)'\1' << endl;
    cout << 1 << endl;

    cout << (int)'\11' << endl;
    cout << 11 << endl;

    return 0;
}

请问,(int)'11'这样输出为什么是9啊?

怪我咯怪我咯2774 days ago470

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 13:47:01

    Escape sequence

    There are five types of escape sequences: Simple, Octal, Hexadecimal, Unicode (UTF-8) and Unicode (UTF-16). The escape sequence can be any of the following:

    See Strings and Character Literals (C++)

    reply
    0
  • Cancelreply