#include <iostream>
#include <string>
#include <algorithm> // for random_shuffle()
#include <ctime> // for time()
#include <cstdlib> // for srand()
using namespace std;
int main()
{
stringboy[5] = {};
stringgirl[5] = {};
// read boys name
for (int i = 0; i < 5; i++)
{
cout << "Enter boy name: ";
cin >> boy[i];
}
// read girls name
for (int i = 0; i < 5; i++)
{
cout << "Enter girl name: ";
cin >> girl[i];
}
// for new random eachtime
srand(time(0));
// girls randomizing
random_shuffle(&girl[0], &girl[5]);
for (int i = 0; i < 5; i++)
{
cout << "Pair " << i + 1 << ": " << boy[i] << " & " << girl[i] << endl;
}
return 0;
}
Comments
Leave a comment