Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.cpp
- // generator smiesznych memuw na wektorach
- //
- // Created by Piotr Neska on 11.12.2016.
- // Copyright © 2016 Piotr Neska. All rights reserved.
- //
- #include <iostream>
- #include <fstream>
- #include <vector>
- #include <string>
- int zlicz(std::string gdzie) {
- std::ifstream liczony(gdzie);
- // new lines will be skipped unless we stop it from happening:
- liczony.unsetf(std::ios_base::skipws);
- // count the newlines with an algorithm specialized for counting:
- unsigned line_count = std::count(
- std::istream_iterator<char>(liczony),
- std::istream_iterator<char>(),
- '\n');
- //std::cout << "Linie w " << gdzie << ": " << line_count << "\n";
- return line_count;
- }
- int main(int argc, const char * argv[]) {
- int linieprefixy=zlicz("prefixy");
- int liniefixy=zlicz("fixy");
- int liniesufixy=zlicz("sufixy");
- //std::cout << "ZAKONCZYLEM ZLICZANIE\n";
- std::fstream prefixy;
- prefixy.open ("prefixy",std::ios::in); // imie
- std::fstream fixy;
- prefixy.open ("fixy",std::ios::in); // rasa
- std::fstream sufixy;
- sufixy.open ("sufixy",std::ios::in); // rola
- //std::cout << "ZAKONCZYLEM WCZYTYWANIE PLIKOW\n";
- std::string line;
- std::vector<std::string> tabprefixy;
- std::vector<std::string> tabfixy;
- while (std::getline(prefixy, line))
- {
- tabprefixy.push_back(line);
- }
- while (std::getline(fixy, line))
- {
- tabfixy.push_back(line);
- }
- //std::cout << "ZAKONCZYLEM CZYTANIE PLIKOW\n";
- int i;
- for(i=0;i<tabprefixy.size();i++)std::cout<<tabprefixy[i]<<"\n";
- for(i=0;i<tabfixy.size();i++)std::cout<<tabfixy[i]<<"\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement