#include <iostream>
using namespace std;
int main() {
cout << "Menu:A(dd)D(elete)S(ort)Q(uit),Select one:" << endl;
char option;
cin >> option;
switch (option) {
case 'A':
cout << "数据已增加" << endl;
break;
case 'D':
cout << "数据已删除" << endl;
break;
case 'S':
cout << "数据已排序" << endl;
break;
case 'Q':
break;
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
cout << "Menu:A(dd)D(elete)S(ort)Q(uit),Select one:" << endl;
char option;
cin >> option;
if (option == 'A') { //双引号是C++中C字符串的快捷语法。如果要比较单个字符,则必须使用单引号代替。
cout << "数据已增加" << endl;
}
else if (option == 'D') {
cout << "数据已删除" << endl;
}
else if (option == 'S') {
cout << "数据已排序" << endl;
}
else if (option == 'Q') {
exit(0);
}return 0;
}