我有此代码的文件:
start:
var: a , b , c;
a = 4;
b = 2;
c = a + b;
wuw c;
end;/
Run Code Online (Sandbox Code Playgroud)
我创建了一个类,其中包含我的代码所在的字符数组:
class file{ //class of program file
private:
ifstream File; //file
char text[X][Y]; //code from file
Run Code Online (Sandbox Code Playgroud)
我使用类的构造函数将文件中的信息加载到数组中:
file(string path)
{
File.open(path); //open file
for(int x = 0 ; x < X ; x++)
{
for (int y = 0; y < Y ; y++) text[x][y] = File.get();
}
}
Run Code Online (Sandbox Code Playgroud)
在类中,我具有从数组写入控制台文本的功能:
void write()
{
for (int x = 0 …Run Code Online (Sandbox Code Playgroud)