void ascending()
{

        int i=0;
        const int SIZE = 20;
        DrinkRecord s[SIZE];
        system("cls");

        ifstream infile;
    infile.open("drinks.txt");//open your file
    if(!infile)//check to make sure its open before trying to initialize list items
    {
    std::cout<<"\nUnable to open file!\n";

    }
    vector<string> list;//create your empty list
    while(!infile.eof())//while the input stream has not reached the end of your file
    {
    string temp = "";//create a temporary string
    for(int i = 0; i < SIZE; i++)
    {
    infile >> temp;//grab the input
    list.push_back(temp);//put it in the next available list slot
    ++i;
    }
    }
    //sort before entering this loop for output
    for(int i = 0; i < SIZE ; i++)
    {
    cout<<endl<<"Item Number\tItem Name\tQuantity\tUnit Price"<<endl;

            do{
                infile>>s[i].itemNumber>>s[i].itemName>>s[i].quantity>>s[i].unitPrice;
                 cout << fixed << showpoint << setprecision (2);
                cout<<s[i].itemNumber<<"\t\t"<<s[i].itemName<<"\t\t"<<s[i].quantity<<"\t\t"<<s[i].unitPrice<<"\t\t" << endl;

            }while(infile.good());
    }

I seriously need help for this. Anyone?

What is the proble you have with this code?
1 Do not compile?
2 Do not give the expected results?
3 You do not undertand what is does?
4....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.