I just know I'm doing something stupid.
The part of my assignment I'm working on is to prompt the user to enter the name of a stock, earnings per share, and price to earning ratio, and then display it after everything is entered.
What it's doing now is asking for stock name, earnings per share, then price-to-earning ratio, then displaying the inputted information, then asking for price-to-earning ratio four more times.
I know I've probably missed something big, but I keep googling and searching the forums here and I can't see any for loops with compound statements inside, so I wonder if that's what I'm screwing up?
Here's the code I'm working on, and thank you for any help you can give.
for (i=0; i < 5; i++)
{
cout << "Enter the name of the stock: ";
cin >> share.name;
std::cin.ignore();
for (j = 0; j < 5; j++)
{
cout << "Enter the earnings per share: ";
cin >> share.earn;
std::cin.ignore();
for (k = 0; k < 5; k++)
{
cout << "Enter the price-to-earning ratio: ";
cin >> share.PtE;
std::cin.ignore();
}
cout << "You entered: \n"
<< share.name << " "
<< share.earn << " "
<< share.PtE;
}
}