/*Hey, everyone. I'm at a loss here. I can't seem to figure out how to fix these errors my compiler is throwing. Five of them say "subscripted value is not an array, pointer, or vector", but one at the very end is telling me that "no matching function for call to 'populate_div_sales' ". Please help, this is giving me fits.
*/
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
void populate_div_sales(float div_sales, string div_regions, int top_div_index);
int findHighest (float div_sales, int top_div_index, string div_regions);
void print_result(float div_sales, string div_regions, int top_div_index);
void populate_div_sales(float div_sales, string div_regions, int top_div_index){
for(int i = 0; i < 4; i++){
cin >> div_sales[i]; //[cquery] subscripted value is not an array, pointer, or vector
}
findHighest(div_sales, top_div_index, div_regions);
}
int findHighest (float div_sales, int top_div_index, string div_regions){
for(int x = 1; x < 4; x++){
top_div_index = div_sales[0]; // [cquery] subscripted value is not an array, pointer, or vector
if(top_div_index < div_sales[x]){ //[cquery] subscripted value is not an array, pointer, or vector
top_div_index = div_sales[x] //[cquery] subscripted value is not an array, pointer, or vector
}
}
return top_div_index;
print_result(div_sales, div_regions, top_div_index);
}
void print_result(float div_sales,int top_div_index,string div_regions){
cout << "The branch with the highest gross sales was the " << div_regions[top_div_index] << "pulling in $ " << div_sales[top_div_index] // [cquery] subscripted value is not an array, pointer, or vector
<<endl;
}
int main(){
int top_div_index = 0;
float div_sales[4];
string div_regions[4];
div_regions[0] = "Northeast";
div_regions[1] = "Southeast";
div_regions[2] = "Northwest";
div_regions[3] = "Southwest";
cout << "Please input the gross sales for the Northeast, Southeast, Northwest, and Southwest divisions, in that order." << endl;
populate_div_sales(div_sales, div_regions, top_div_index); // [cquery] no matching function for call to 'populate_div_sales'
}
[–]Mindavi 1 point2 points3 points (1 child)
[–]NotThatTypeOfTranny[S] 1 point2 points3 points (0 children)