Don't pass string by value unless you really need a copy to be made - pass by ref or const ref.
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
const string teams[] {"Wolves", "Dream FC", "United DC", "Mkeys"};
for (const string& home_team : teams)
for (const string& away_team : teams)
if (home_team != away_team)
cout << home_team + " Vs " + away_team << '\n';
}
Wolves Vs Dream FC
Wolves Vs United DC
Wolves Vs Mkeys
Dream FC Vs Wolves
Dream FC Vs United DC
Dream FC Vs Mkeys
United DC Vs Wolves
United DC Vs Dream FC
United DC Vs Mkeys
Mkeys Vs Wolves
Mkeys Vs Dream FC
Mkeys Vs United DC