I am a beginner student looking for help on a program my professor assigned. The task is to use 2 parallel loops to ask the user 5 different salsas and their cost. Then print out the name, total sold, average, best seller and worst selling. The thing is, I can calculate best and worst selling, but those are ints. I don't understand how I can pull the string instead of int? Any help would be appriciated!#include
#include <string>
#include <cmath>
#include <cstring>
using namespace std;
int main() {
    string name[5];
    int total[5];
    int i, final, counter, high, low;
    for(i=0; i<=4; i++){
        cout << "Salsa name: ";
        cin >> name[i];
        cout << "How many of " << name[i] << " were sold? ";
        cin >> total[i];
        final += total[i];
        if(i < 0) {
            "Sorry, you cannot have negative sales!";
            return 0;
        } else {
            if(counter == 0) {
                low = total[i];
            } else if (total[i] < low) {
                low = total[i];
            } else if (total[i] > high) {
                high = total[i];
            } counter++;
        }
    }
        cout << "Name          Amount Sold\n"
             << "-------------------------\n";
        for(int i = 0; i <= 4; i++){
            cout << name[i] << "        " << total[i] << endl;
        }
    cout << "Total sold: " << final << endl
         << "Most Sold: " << high << endl
         << "Least Sold: " << low;
    return 0;
}
output:
Running /home/ubuntu/workspace/Ch6_Ex3.cpp
Salsa name: salsa1
How many of salsa1 were sold? 10
Salsa name: salsa2
How many of salsa2 were sold? 20
Salsa name: salsa3
How many of salsa3 were sold? 30
Salsa name: salsa4
How many of salsa4 were sold? 40
Salsa name: salsa5
How many of salsa5 were sold? 50
Name          Amount Sold
-------------------------
salsa1        10
salsa2        20
salsa3        30
salsa4        40
salsa5        50
Total sold: 32862
Most Sold: 50
Least Sold: -547659664
Process exited with code: 0
 
    