Question: I want to promt for a string variable (name of item) and then promt for a double variable (cost). I want this to be done 5 times so each time it loops the vales are stored as a different pair of variable. 

need to have user input an item and then its price so i can calc a bill.
not sure if I can crate a loop for this or i need to keep a running count somehow 

```
int main()
{

    int i;
    string  Item_1,Item_2,Item_3,Item_4,Item_5;

    double Price_1,Price_2,Price_3,Price_4,Price_5 ;

    while (i<6)
    {

    cout<<"Please enter item"<<endl;
    cin>> Item_1>>Item_2>>Item_3>>Item_4>>Item_5>>endl; 

    cout<<"Please enter cost of   " >> Item_1>>Item_2>>Item_3>>Item_4>>Item_5;
    cin>>Price_1>>Price_2>>Price_3>>Price_4>>Price_5;

    i=i++
    }

    return 0;

}

```

Code doesn't compile but i expect it to ask for my in put for the 5 variables 5 times

Answer: 
Here is a solution with `arrays` and a `for` loop.

You can try it in [CPP Shell](http://cpp.sh/).

```
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string  Item[5];

    double Price[5] ;

    for(int i = 0; i < 5; i++)
    {

        cout<<"Please enter item"<<endl;
        cin>> Item[i];

        cout<<"Please enter cost of "  << Item[i] << ":" << endl;
        cin>>Price[i];
    }

    cout << "Items: ";
    for(int i = 0; i < 5; i++)
    {
        cout << Item[i] << " ";
    }

    cout << endl << "Prices: ";
    for(int i = 0; i < 5; i++)
    {
        cout << Price[i] << " ";
    }

    return 0;
}

```
Your code doesn't compile for many reasons!  

Of course you can use a loop for your purpose. Consider the following code, which is not really good, but does the job:

```
#include <string>
#include <iostream>

using namespace std;

int main()
{

    int i = 1;
    string Item[5];

    double Price[5];

    while (i<6)
    {
        cout<<"Please enter item "<< i << ": ";

        cin>>Item[i-1]; 
        cout<<endl;

        cout <<"Please enter cost of "<< Item[i-1] << ": ";
        cin >> Price[i-1];

        i++; 
    };

    i = 1;
    while (i<6)
    {
        cout << "Item " << i << ": " << Item[i-1] << ", Price: " << Price[i-1] << endl;
        i++;
    };
    return 0;

}

```