Advertisement
Guest User

teraz diała

a guest
Dec 11th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cstdlib>
  4. #include <string>
  5. int main() {
  6.  
  7.     std::string tabprefixy[ 100 ];
  8.     std::string tabfixy[ 100 ];
  9.     std::string tabsufixy[ 100 ];
  10.  
  11.    std::fstream prefixy;
  12.    prefixy.open( "prefixy", std::ios::in ); // imie
  13.     std::fstream fixy;
  14.     fixy.open( "fixy", std::ios::in ); // rasa
  15.     std::fstream sufixy;
  16.     sufixy.open( "sufixy", std::ios::in ); // rola
  17.  
  18.     std::string napis;
  19.     std::string temp;
  20.  
  21.     int lp = 0;
  22.     while( !prefixy.eof() )
  23.     {
  24.         getline( prefixy, napis );
  25.         tabprefixy[ lp ] = napis;
  26.         std::cout << napis << std::endl;
  27.         lp++;
  28.     }
  29.     prefixy.close();
  30.  
  31.     std::cout << "fixy\n";
  32.     int lf = 0;
  33.     while( !fixy.eof() )
  34.     {
  35.         getline( fixy, napis );
  36.         tabfixy[ lf ] = napis;
  37.         std::cout << napis << std::endl;
  38.         lf++;
  39.     }
  40.     fixy.close();
  41.  
  42.     std::cout << "suffixy\n";
  43.     int ls = 0;
  44.     while( !sufixy.eof() )
  45.     {
  46.         getline( sufixy, napis );
  47.         tabsufixy[ ls ] = napis;
  48.         std::cout << napis << std::endl;
  49.         ls++;
  50.     }
  51.     sufixy.close();
  52.  
  53.    srand( time( NULL ) );
  54.    int rp = rand() % lp;
  55.    int rf = rand() % lf;
  56.    int rs = rand() % ls;
  57.   std::cout<<"output:\n";
  58.    std::cout << tabprefixy[ rp ] << tabfixy[ rf ] << tabsufixy[ rs ]<<std::endl;
  59.  
  60.     return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement