Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- //дан текстовый файл, напечатать все нечетные строки
- using namespace std;
- int main()
- {
- ifstream in("in.txt");
- string s;
- int i = 1;
- while(in.peek() != EOF)
- {
- getline(in, s);
- if (i % 2)
- cout << s << endl;
- i++;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement