首页 > 代码库 > 【cpp】chap 8

【cpp】chap 8

1.输出“输入的内容”

// basic file operations
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

std::istream& func(std::istream &is)
{
    std::string buf;
    while (is >> buf)
        std::cout << "output = " << buf << std::endl;
    is.clear();
    return is;
}

int main() {
    std::istream &is=cin;
    func(is);
}

 

【cpp】chap 8