Главная » 2019 » Май » 7 » Файл. Считывание из файла
09:11
Файл. Считывание из файла

#include <iostream>
#include <fstream>
using namespace std;
int main()
{
    ifstream f;
    f.open("d:\\test.txt");
    char str[80];
    do
    {
        f >> str; 
        bool flag=false;
        for (int i=0;i<strlen(str);i++)
            if (str[i]=='2') flag=true;
        if (flag) 
            cout<<str<<" ";
    } while (f.peek()!=EOF);
    f.close();
    system("pause");
}

 

Просмотров: 304 | Добавил: denjes | Рейтинг: 0.0/0
Всего комментариев: 0
avatar