Command Prompt

Revision en2, by DaRealDevelopMaster, 2021-09-21 17:06:23

This is a Command Prompt I made plz test it and rate it.

Note : code in C++

/**
Made by : DaRealDevelopMaster
*/
#include <bits/stdc++.h>
#include <Windows.h>
#include <cstdlib>
using namespace std;
int main()
{
    cout << "Command Prompt\n";
    cout << "This is the secound time making this from start\n";
    cout << "Version 1.1.0\n";
    cout << "Choose a prefix ex(/,#,;,\) : ";
    char prefix;
    cin >> prefix;
    cout << "\n";
    while(true){
        string s;
        cin >> s;
        if(s.substr(1,10) == "palindrome"){
            string palindrome1;
            cin >> palindrome1;
            string palindrome2 = palindrome1;
            reverse(palindrome2.begin(),palindrome2.end());
            if(s[0] != prefix){
                cout << "Error code#1 (UNKNOWN PREFIX)\n";
                continue;
            }
            if(palindrome1 == palindrome2){
                cout << "Yes\n";
            }
            else{
                cout << "No\n";
            }
        }
        else if(s.substr(1,5) == "sound"){
            if(s[0] != prefix){
                cout << "Error code#1 (UNKNOWN PREFIX)\n";
                continue;
            }
            cout << "\a";
        }
        else if(s.substr(1,6) == "prefix"){
            char prefix2;
            cin >> prefix2;
            if(s[0] != prefix){
                cout << "Error code#1 (UNKNOWN PREFIX)\n";
                continue;
            }
            if(prefix2 == prefix){
                cout << "You choose the same prefix\n";
            }
            else{
                cout << "Your new prefix is : " << prefix2 << "\n";
            }
            prefix = prefix2;
        }
        else if(s.substr(1,5) == "count"){
            int x;
            cin >> x;
            if(s[0] != prefix){
                cout << "Error code#1 (UNKNOWN PREFIX)\n";
                continue;
            }
            for(int i = 0;i <= x;i++){
                cout << i << "\n";
                Sleep(1000);
            }
            cout << "\a";
        }
        else if(s.substr(1,5) == "timer"){
            int x;
            cin >> x;
            if(s[0] != prefix){
                cout << "Error code#1 (UNKNOWN PREFIX)\n";
                continue;
            }
            x++;
            while(x--){
                cout << x << "\n";
                Sleep(1000);
            }
            cout << "\a";
        }
        else if(s.substr(1,5) == "alarm"){
            int x;
            cin >> x;
            if(s[0] != prefix){
                cout << "Error code#1 (UNKNOWN PREFIX)\n";
                continue;
            }
            x++;
            while(x--){
                Sleep(1000);
            }
            cout << "\a\a\aAlarm is up\a\a\a\n";
        }
        else if(s.substr(1,5) == "close"){
            cout << "Thanks for using my Command Prompt\n\n";
            return 0;
        }
        else if(s.substr(1,6) == "hacker"){
            system("color 02");
            cout << "YOU ARE NOW A HACKER\n";
        }
        else{
            cout << "Error code#2(UNKNOWN COMMAND)\n";
        }
    }
}

First you choose a prefix

Note : I am using / as a prefix you can choose any thing.

Commands :

1./palindrome 123

If the number/string you put was a palindrome the program will print yes else will preint no.

2./sound

Will make a sound beep.

3./prefix !

Will change the prefix from / to ! or any thing you want.

4./count 5

Will count from 0 to 5 and a second delay between every two number.

5./timer 5

Timer is the opposite of count it will set a timer for 5 to 0 with a second between every two number.

6./alarm 5

Will wait 5 second then print Alarm is up.

7./close

Will close the program.

There is one more hidden command,

read the code to find it.

If there is a feedbacks comment it.

Thanks for reading.

Tags c++, code, compilers, coder

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English DaRealDevelopMaster 2021-09-21 17:06:23 0 (published)
en1 English DaRealDevelopMaster 2021-09-20 20:18:07 4071 Initial revision (saved to drafts)