Need help finishing my program

I am constructing a random text generator and i am almost done i just need help on the final output.

here is my coding

#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
using namespace std;

const int NUM_FRIENDS = 5;

int main()
{
srand(time(NULL));
string friends[NUM_FRIENDS];
int seed;

cout << "==Who should i Text?==" << endl;
cout << "Enter seed" << endl;
cin >> seed;

for (int count = 0; count < NUM_FRIENDS; count++)
{
cout << "Enter Friend " << count << endl;
cin >> friends[count]
}

int name_selected = rand() % 5;

cout << "You should text: " << friends[name_selected] << endl;
cout << "These other friends didn't make the cut: " << endl;

return 0;
}

This is how the output is supposed to look like

Program Output

== Who Should I Text? ==
Enter seed
Enter friend 0
Enter friend 1
Enter friend 2
Enter friend 3
Enter friend 4
You should text: Cat
These other friends didn't make the cut:
Adam
Bill
Damion
Edward

I can't figure how to output the remaining names
Do a for loop over the friends array. If the current index is not name_selected, output that name, otherwise do nothing
i was thinking the for loop would look like this

for (int x = 0; x < NUM_FRIENDS; x++)
{
cout << friends[x] << endl;
}

but that output all of the names that were inputed i can't figure how to only output the names that were not selected by the random generator.
1
2
3
4
5
6
7
for (int x = 0; x < NUM_FRIENDS; x++)
{
   if (x!=name_selected)
   {
      cout << friends[x] << endl;
   }
}
Topic archived. No new replies allowed.