#include <iostream> using namespace std; int main( void ) { char answer; cout << "你今天上课了吗? "; cin >> answer; if( answer == 'y' ) cout << "上了" << endl; else if( answer == 'n' ) cout << "没上" << endl; else cout << "请直接回答 y 或 n" << endl; return 0; }