Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <sstream>
- using namespace std;
- int main(){
- cout << "Iveskite duomenu failo varda: ";
- string vardas;
- cin >> vardas;
- fstream in(vardas, fstream::in);
- int kiek = 0;
- if(in.is_open()){
- string line;
- //in >> line;
- while(1){
- getline(in, line);
- //cout << in.good() << in.bad() << in.fail() << in.eof() << " ";
- if(in.fail())
- break;
- kiek++;
- //cout << line << endl;
- }
- in.close();
- cout << "Faile yra " << kiek << " eiluciu" << endl;
- } else {
- cout << "Nepavyko atidaryti failo." << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement