#include <iostream>
#include <bits/stdc++.h>
using namespace std;
class File {
public:
int address;
int parent;
string name;
File(string n, int a, int p) {
name = n;
address = a;
parent = p;
}
};
class HardDrive {
public:
static vector<File> files;
static void add_file(File f) {
files.push_back(f);
}
static int newAddress() {
return files.size();
}
static File getFile(int address) {
return files[address];
}
};
class textFile: public File {
public:
string data;
};
class Folder: public File {
public:
vector<int> children;
Folder* copy() {
Folder* f = new Folder(name, HardDrive::newAddress(), parent);
f->children = children;
return f;
}
int createChild(string name) {
File* f = new File(name, HardDrive.newAddress());
f.parent = this.address;
HardDrive::add_file(f);
return f.address;
}
};
vector<string> parseCMD(string cmd) {
vector <string> tokens;
stringstream check1(cmd);
string intermediate;
while(getline(check1, intermediate, '_'))
{
tokens.push_back(intermediate);
}
return tokens;
}
int main() {
cout << ">----OmniOS----<\n" << endl;
string command;
bool running = true;
while (running) {
cout << "> ";
cin >> command;
vector<string> parts = parseCMD(command);
if (parts[0] == "end") {
running = false;
}
cout << endl;
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: