Last active
April 10, 2017 19:28
-
-
Save mAlishera/e1e5b0bacd98ddebae8d5c1fb3da21e8 to your computer and use it in GitHub Desktop.
считает количество гласных в строках файла и выводит строку с максимальным количеством
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <stdio.h> | |
#include <iostream> | |
#include <fstream> | |
#include <sstream> | |
using namespace std; | |
int main() | |
{ | |
int ii(0), max(0); | |
char c; | |
string str, b; | |
ifstream r; | |
r.open("st.txt"); | |
while (!r.eof()) { | |
while(getline(r, str)) { | |
istringstream ss(str); | |
while(ss >> c) { | |
if ((c == 'a') || (c == 'e') || (c == 'u') || (c == 'i') || (c == 'o') || (c == 'y')) { | |
ii++; | |
} | |
} | |
cout << ii; | |
cout<<endl; | |
if (ii>max) { | |
max = ii; | |
b = str; | |
ii = 0; | |
} | |
} | |
} | |
cout << b; | |
cout<<endl; | |
r.close(); | |
cout<<endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment