効果の表示:
提供されるコマンドは次のとおりです
。hello
color
cls
quit
exit
ソースコード:
#include <iostream>
#include <cstdlib>
#include <cstring>
int main()
{
using namespace std;
system("cls");
cout << "my Shell >>> ";
// string myinput;
char myinput[10];
scanf("%s",myinput);
// cin >> myinput;
while ( myinput != '\0' ){
if (!strcmp(myinput, "exit")){
exit(0);
}
if (!strcmp(myinput, "quit")){
exit(0);
}
if (!strcmp(myinput, "cls")){
system("cls");
}
if (!strcmp(myinput, "hello")){
cout << "Hello, user Bob, nice to meet you" << endl;
}
if (!strcmp(myinput, "color")){
system("color 2f");
}
cout << "my Shell >>> ";
scanf("%s",myinput);
}
return 0;
}