Why wont my void reference function work in the for loop


Hi, I was wondering why the reference type was not printing out the information in the function AskFishShowers to the console. when every I run it just says"here's your menu" but doesn't actually show the menu that I put in the function FillVectors.

#include <iostream>
#include <string>
#include <vector>


using namespace std;

int main(){
int pointer;

vector<string> fishShowerType;

vector<int> minPondSizeForShower;

vector<int> maxPondSizeForShower;

AskFishShower(fishShowerType, &pointer);


}



void FillVectors(vector<string> &type, vector<int> &minGal, vector<int> &maxGal);

void AskFishShower(vector<string> &type, int*pIndex);



void FillVectors(vector<string> &type, vector<int> &minGal, vector<int> &maxGal) {

type.push_back("Shebunkin Sprayer");
type.push_back("Koi Rain Head ");
type.push_back("Gold Fish");
type.push_back("boi");
type.push_back("bucky");

minGal.push_back(200);
minGal.push_back(300);
minGal.push_back(400);
minGal.push_back(900);
minGal.push_back(3000);

maxGal.push_back(400);
maxGal.push_back(500);
maxGal.push_back(1000);
maxGal.push_back(5000);
maxGal.push_back(10000);

}

void AskFishShower(vector<string> &type, int*pIndex) {

cout << "Heres your Menu" << endl;
int answer;

for ( unsigned int i = 0; i < type.size(); i++) {
cout<<i+1 << &type.at(i) << endl;

}

cout << "Enter your answer: ";
cin >> answer;
*pIndex = answer - 1;


}
You never call FillVectors so the vectors are still empty when you call AskFishShower.
how would I call Fillvectors in AskFishSHower?
I would have thought you wanted to call Fillvectors from main, before you call AskFishShower.
Topic archived. No new replies allowed.