c++中,cout<<d.a<<'\t'<<d.b<<endl;这句中的\t是什么意思啊?
#include<iostream.h>classT{public:T(intx,inty){a=x;b=y;cout<<"调用构造函数1."<<endl;cout<<a...
#include < iostream.h >
class T
{ public :
T( int x, int y )
{ a = x ; b = y ;
cout << "调用构造函数1." << endl ;
cout << a << '\t' << b << endl ;
}
T( T &d )
{ cout << "调用构造函数2." << endl ;
cout << d.a << '\t' << d.b << endl ;
}
~T() { cout << "调用析构函数."<<endl; }
int add( int x, int y = 10 ) { return x + y ; }
private :
int a, b ;
};
void main()
{ T d1( 4, 8 ) ;
T d2( d1 ) ;
cout << d2.add( 10 ) << endl ;
}
问题出自这个程序. 展开
class T
{ public :
T( int x, int y )
{ a = x ; b = y ;
cout << "调用构造函数1." << endl ;
cout << a << '\t' << b << endl ;
}
T( T &d )
{ cout << "调用构造函数2." << endl ;
cout << d.a << '\t' << d.b << endl ;
}
~T() { cout << "调用析构函数."<<endl; }
int add( int x, int y = 10 ) { return x + y ; }
private :
int a, b ;
};
void main()
{ T d1( 4, 8 ) ;
T d2( d1 ) ;
cout << d2.add( 10 ) << endl ;
}
问题出自这个程序. 展开
3个回答
展开全部
\ 是转义符 正常的字母前面加上'\'就变成另一种意思了 比如: \t 代表 制表符 \n 换行 \r 回车 \a发出报警声音等等
具体如下表:
\a
Bell (alert)
\b
Backspace
\f
Formfeed
\n
New line
\r
Carriage return
\t
Horizontal tab
\v
Vertical tab
\'
Single quotation mark
\"
Double quotation mark
\\
Backslash
\?
Literal question mark
\ooo
ASCII character in octal notation
\xhh
ASCII character in hexadecimal notation
\xhhhh
Unicode character in hexadecimal notation if this escape sequence is used in a wide-character constant or a Unicode string literal.
For example, WCHAR f = L'\x4e00' or WCHAR b[] = L"The Chinese character for one is \x4e00".
具体如下表:
\a
Bell (alert)
\b
Backspace
\f
Formfeed
\n
New line
\r
Carriage return
\t
Horizontal tab
\v
Vertical tab
\'
Single quotation mark
\"
Double quotation mark
\\
Backslash
\?
Literal question mark
\ooo
ASCII character in octal notation
\xhh
ASCII character in hexadecimal notation
\xhhhh
Unicode character in hexadecimal notation if this escape sequence is used in a wide-character constant or a Unicode string literal.
For example, WCHAR f = L'\x4e00' or WCHAR b[] = L"The Chinese character for one is \x4e00".
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询