Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int num_names = 5;
- string friend_list[5];
- int friend_list_id[5];
- cout << "Enter five names\n";
- for (int index = 0, num_friend = 1; index < 5; index++, num_friend++)
- {
- cout << "Enter friend " << num_friend << endl;
- cin >> friend_list[index];
- friend_list_id[index] = num_friend;
- }
- cout << "Here are all of those names\n";
- for (int index = 0; index < 5; index++)
- {
- cout << "Friend " << friend_list_id[index] << " is " << friend_list[index] << endl;
- }
- int best_friend;
- cout << "Which friend is your best friend? (Enter an integer)\n";
- cin >> best_friend;
- for (int index = 0; index < 5; index++)
- {
- if (best_friend == friend_list_id[index])
- {
- cout << friend_list[index] << "? Yes, " << friend_list[index];
- cout << " is awesome\n";
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment