在C++中,三字母是代表单个字符三字符序列。这意味着三字母组合序列是从双问号(??)开始的三个字符的集合。这些字符使用称为三字的3个字符序列构成,这些字符集由一个字符代替。
S.No. | Trigraph | Equivalent |
---|---|---|
1. | ??= | # |
2. | ??/ | \ |
3. | ??’ | ^ |
4. | ??( | [ |
5. | ??) | ] |
6. | ??! | | |
7. | ??< | { |
8. | ??> | } |
9. | ??- | ~ |
句法:
??=define
Becomes,
#define
以下是Trigraphs序列的基本实现示例:
C++
// C++ implementation to
// illustrate the example
// of trigraph sequences
# include
using namespace std;
??=define MSG "GeeksforGeeks"
??=define Program "C++"
// Driver Code
int main()
??< // Here ??< denotes {
cout << "My message to " << MSG << endl;
cout << "My program is " << Program;
return 0;
??> // Here ??> denotes }
C++
// C++ program to demonstrate
// the example
// of trigraph sequences
# include
using namespace std;
// Here ??= denotes #
??=define Name "Kalpana"
??=define Age "23"
??=define Qualification "B.tech"
??=define From "Delhi"
// Driver Code
int main()
??<
cout << "My Name is: " << Name << endl;
cout << "My Age is: " << Age << endl;
cout << "My Qualification is: "
<< Qualification << endl;
cout << "I'm From " << From;
return 0;
??>
输出:
My message to GeeksforGeeks
My program is C++
以下是Trigraph序列的另一个示例:
C++
// C++ program to demonstrate
// the example
// of trigraph sequences
# include
using namespace std;
// Here ??= denotes #
??=define Name "Kalpana"
??=define Age "23"
??=define Qualification "B.tech"
??=define From "Delhi"
// Driver Code
int main()
??<
cout << "My Name is: " << Name << endl;
cout << "My Age is: " << Age << endl;
cout << "My Qualification is: "
<< Qualification << endl;
cout << "I'm From " << From;
return 0;
??>
输出:
My Name is: Kalpana
My Age is: 23
My Qualification is: B.tech
I'm From Delhi
要从最佳影片策划和实践问题去学习,检查了C++基础课程为基础,以先进的C++和C++ STL课程基础加上STL。要完成从学习语言到DS Algo等的更多准备工作,请参阅“完整面试准备课程” 。