Print out a List of animals [closed]

I am working to get the list of 5 animals name from the user and list them. So, far this is what I have. How can I output 1. animal1, 2. animal2 and so on.

#include <vector>
#include <string>
#include <iostream>
#include <cstdlib>
#include <set>

using namespace std;

int main() {

    string animal;
    int num_animals = 0;
    cout << "Enter name of 5 animals of your choice. e.g., cat, << 
    dog, etc..   "<< endl;
    cout << ">>";
    cin >> animal;
    char temp; cin>> temp;

    while (getline(cin, animal)) {

        if (animal.empty() || cin.eof())
        cout << ">> ";
    int a[5];
    int i;
    char j= ':';
    vector <string> animals;
    animals.push_back (animal);
    for ( i = 1; i < 6; )
        cout << i++ <<j << animals << '\n';

    cout << '\n' << "Bye.....";
    return 0;

Read more here:

Content Attribution

This content was originally published by Mostafiz at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: