sinat_26139995 2015-03-14 05:34 采纳率: 0%
浏览 1660

这是一个有关于C++的问题,作业中遇到的问题,求助!

read one string from the file called "infile.txt" into your string class using your read member function()
The class will store the string in dynamic memory that is pointed to with the pointer. When you first create an MYString object you should allocate 20 spaces of memory (using the new command). The string will be stored as a cstring in this memory.
我需要用到这个函数 read( istream & istr) : bool ,并且要在.cpp文件中实现,请问我应怎样完成这个操作?

  • 写回答

2条回答 默认 最新

  • yleek 2015-03-14 13:35
    关注

    class MYString
    {
    private:
    char *_data;
    public:
    MYString()
    {
    _data = new char[20];
    }

        void read()
        {
            // read from infile.txt
        }
    

    };

    作业的要求是这样吧好像是。

    评论

报告相同问题?

悬赏问题

  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题