#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
int main()
{
int c = 0;
ifstream infile("c:\\test.txt");
string str;
while (infile>>str)
{
cout<<str<<endl;
++c;
}
string x("hello world, damn it. haha");
stringstream ss(x);
c = 0;
while (ss>>str)
{
cout<<str<<endl;
++c;
}
infile.close();
return 0;
}
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
int main()
{
int c = 0;
ifstream infile("c:\\test.txt");
string str;
while (infile>>str)
{
cout<<str<<endl;
++c;
}
string x("hello world, damn it. haha");
stringstream ss(x);
c = 0;
while (ss>>str)
{
cout<<str<<endl;
++c;
}
infile.close();
return 0;
}