初识输出输入流
#include <iostream>int main()
{
char answer;
std::cout << "请输入您的选择:【Y/N】:" << "\n";
std::cin >> answer ;
switch(answer)
{
case 'Y':
case 'y':
std::cout << "你选择了同意!!!" << "\n";
break;
case 'N':
case 'n':
std::cout << "你选择了不同意!!!" << "\n";
break;
default:
std::cout << "你输入的是错误的!!!" << "\n";
break;
}
return 0;
}
页:
[1]