When I run the program it only prints out the numbers entered into the array but it will not print out the name of the array. Can anyone assist me on why it is not working?

Example:
The amount each salsa sold are: 4

The amount each salsa sold are: 5

The amount each salsa sold are: 8

The amount each salsa sold are: 6

The amount each salsa sold are: 1
Your total amount of sales is: 24
Your highest selling Salsa is: 8
Your highest selling Salsa is: 8

Instead of:
The amount each salsa sold are:
Mild: 4
The amount each salsa sold are:
Zesty: 5, etc.
Your highest selling Salsa is Hot: 8
Your lowest selling Salsa is Medium: 1

#include <iostream>
#include <string>
using namespace std;

void showSold(int sales[], int salsa);
int showTotal(int sales[], int salsa);
int showHighest(int sales[], int salsa);
int showLowest(int sales[], int salsa);


int main()
{
	const int SALSA = 5;
	string name[SALSA] = {"mild", "medium", "sweet", "hot", "zesty"}; //Salsa Types
	int sales[SALSA];
	int total,
		highest,
		lowest;

	cout << "Please enter the number of jars sold for each salsa\n";
	for(int count = 0; count < SALSA; count++)
	{
		cout << name[count] << ": ";
		cin >> sales[count];

		while(sales[count] < 0)
		{
			cout << "You must enter a number 0 or greater. Please try again\n";
			cin >> sales[count];
		}
	}

	
	showSold(sales, SALSA);
	
	total = showTotal(sales, SALSA);
	highest = showHighest(sales, SALSA);
	lowest = showLowest(sales, SALSA);

	cout << "Your total amount of sales is: " << total << endl;
	cout << "Your highest selling Salsa is: " << name[highest] << endl;
	cout << "Your lowest selling Salsa is: " << name[lowest] << endl;

	return 0;
}

void showSold(int sales[], int salsa)
{
	for(int count = 0; count < salsa; count++)
	{
		cout << "The amount each salsa sold are:\n";
		cout << sales[count] << " ";
		cout << endl;
	}
}

int showTotal(int sales[], int salsa)
{
	int total = 0;

	for(int count = 0; count < salsa; count++)

		total += sales[count];

	return total;
}

int showHighest(int sales[], int salsa)
{
	int highest;
	highest = sales[0];
	
	for(int count = 1; count < salsa; count++)
	{
		if (sales[count] >highest)
			highest = sales[count];
	}
	return highest;
}

int showLowest(int sales[], int salsa)
{
	int lowest;
	lowest = sales[0];
	
	for(int count = 1; count < salsa; count++)
	{
		if (sales[count] < lowest)
			lowest = sales[count];
	}
	return lowest;
}

Hello, do you want it just to say

The amount each salsa sold are: 4

The amount each salsa sold are: 5

The amount each salsa sold are: 8

The amount each salsa sold are: 6

The amount each salsa sold are: 1
Your total amount of sales is: 24
Your highest selling Salsa is: 8
Your highest selling Salsa is: 8

Or do you want it to be user input too?

Hello, do you want it just to say
Or do you want it to be user input too?

It currently prints out just the numbers, My intention/goal is for it to print out the names with the numbers sold, etc.

Example of what I want it to print out is this:
The amount each salsa sold are:
Mild: 4

The amount each salsa sold are:
Zesty: 5, etc.

Your highest selling Salsa is Hot: 8
Your lowest selling Salsa is Medium: 1

If no user input and just want a CMD to say (what you posted) use std::cout<< "text here";

This article has been dead for over six months. Start a new discussion instead.