I'm having trouble inserting a bubble sort for my program, any help would be appreciated.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string food[100];
string lookup;
int calories[100];
int x = -1;
do
{
x++; cout << "Enter a menu item (enter 'done' when finished): ";
getline(cin,food[x]);
if (food[x] != "done")
{
cout << "Enter the number of calories: ";
cin >> calories[x];
cin.ignore();
}
}while (food[x] != "done");
do
{
bool found = false;
cout << "Enter a product to look up: " ;
getline(cin, lookup);
for (int y = 0; y < x; y++)
if (lookup == food[y])
{
cout << food[y] << " has " << calories[y] << " calories." << endl;
found = true;
}
if ((found == false) && (lookup != "done"))
{
cout << lookup << " was not found." << endl; }
} while (lookup != "done");
}