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
        }
    

    };

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

    评论

报告相同问题?

悬赏问题

  • ¥15 MATLAB动图的问题
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名