prog4_01.cpp

来自「c++最经典的入门书籍」· C++ 代码 · 共 28 行

CPP
28
字号
// Program 4.1 Comparing data values
#include <iostream>
using std::cin;
using std::cout;
using std::endl;

int main() {
  char first = 0;                       // Stores the first character
  char second = 0;                      // Stores the second character

  // Prompt for and read in the first character
  cout << "Enter a character: ";
  cin >> first;

  // Prompt for and read in the second character
  cout << "Enter a second character: ";
  cin >> second;

  cout << "The value of the expression first < second is: "
       << (first < second)
       << endl
       << "The value of the expression first == second is: "
       << (first == second)
       << endl;

  return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?