小编Чер*_*ень的帖子

'?' 而是文件中的普通文本

我有此代码的文件:

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)

c++ cout file ifstream multidimensional-array

1
推荐指数
1
解决办法
96
查看次数

标签 统计

c++ ×1

cout ×1

file ×1

ifstream ×1

multidimensional-array ×1