Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstdlib>
- #include <string>
- int main() {
- std::string tabprefixy[ 100 ];
- std::string tabfixy[ 100 ];
- std::string tabsufixy[ 100 ];
- std::fstream prefixy;
- prefixy.open( "prefixy", std::ios::in ); // imie
- std::fstream fixy;
- fixy.open( "fixy", std::ios::in ); // rasa
- std::fstream sufixy;
- sufixy.open( "sufixy", std::ios::in ); // rola
- std::string napis;
- std::string temp;
- int lp = 0;
- while( !prefixy.eof() )
- {
- getline( prefixy, napis );
- tabprefixy[ lp ] = napis;
- std::cout << napis << std::endl;
- lp++;
- }
- prefixy.close();
- std::cout << "fixy\n";
- int lf = 0;
- while( !fixy.eof() )
- {
- getline( fixy, napis );
- tabfixy[ lf ] = napis;
- std::cout << napis << std::endl;
- lf++;
- }
- fixy.close();
- std::cout << "suffixy\n";
- int ls = 0;
- while( !sufixy.eof() )
- {
- getline( sufixy, napis );
- tabsufixy[ ls ] = napis;
- std::cout << napis << std::endl;
- ls++;
- }
- sufixy.close();
- srand( time( NULL ) );
- int rp = rand() % lp;
- int rf = rand() % lf;
- int rs = rand() % ls;
- std::cout<<"output:\n";
- std::cout << tabprefixy[ rp ] << tabfixy[ rf ] << tabsufixy[ rs ]<<std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement