Přeskočit na obsah

Zdroják: Kombinace proměnných.cpp

Z Wikiverzity
  1. include <vector>
  2. include <iostream>
  3. include <fstream>
  4. include<string>
  5. include<cstdio>

using namespace std; int main(int argc, char *argv[]) {

  if (argc != 3)
  {
     cerr << "Nutno volat s parametrem 2 souborů !" << endl;
     return -1;
  }
   typedef std::vector<std::string> intdeq;
   intdeq var;
   string s;
    ifstream in2(argv[2]);
    while(getline(in2, s) ){var.push_back(s);}
   intdeq::iterator ib = var.begin();
   intdeq::iterator ie = var.end();
   intdeq::iterator it=ib;
   ifstream in(argv[1]);
   while(getline(in, s) ){
       for (it=ib;it!=ie;++it) std::cout<<"["<<s<<","<<*it<<"] \n";
   }
   return 0;

}