练习2-3:编一个程序用来打开文件并统计文件中以空格隔开的单词数目

    技术2022-05-19  25

    #include<iostream>#include<string>#include<fstream>using namespace std;

     

    void main(){ ifstream in("e://test.txt"); string word; int num=0; while(in>>word) {  cout<<word<<" ";  num++; } cout<<endl<<num<<endl;}


    最新回复(0)