Trying to pass some strings and integers into a menu class.
menu.initialize should take a string, string, array of strings, array of integers and an integer. That's exactly what I'm passing to it too!
main:
Code:
string mainHead = "Main Menu";
string mainPrompt = "Enter choice: ";
int mainNumChoices = 7;
int checkNumChoices = 3;
int saveNumChoices = 4;
int mainChoices[7] = {1,2,3,4,5,6,7};
string mainBody[7]= {"Add Checking", "Add Savings", "Remove Checking",
"Remove Savings", "View Checking", "View Savings", "Exit"};
menu newMenu;
newMenu.initialize(mainHead, mainPrompt, mainBody[7], mainChoices[7], mainNumChoices);
menu:
Code:
//menu
#ifndef menu_h
#define menu_h
#include <string>
#include <iostream>
const int MAX_NUM_ITEMS = 10;
using namespace std;
class menu
{
public:
menu();
menu(string, string, string[], int[], int);
~menu();
void initialize(string, string, string[], int[], int);
//Title, prompt, body[MAX_NUM_ITEMS],
//current choice[MAX_NUM_ITEMS], numChoices)
void display();
int get_choice();
void run();
private:
int choice, numChoices, choices[MAX_NUM_ITEMS];
string title, prompt, body[MAX_NUM_ITEMS];
bool validate_choice();
};
#endif
//menu.cpp
#include "menu.h"
void menu::initialize(string _title, string _prompt, string _body[],
int _currentChoice[], int _numChoices)
{
title = _title;
prompt = _prompt;
numChoices = _numChoices;
for(int i = 0; i < numChoices; i++)
{
currentChoice[i] = _currentChoice[i];
body[i] = _body[i];
}
}//! End of constructor
error:
Code:
20 C:\Documents and Settings\Owner\Desktop\CodeBlocks\Take Home Final\mainline.cpp no matching function for call to `menu::initialize(std::string&, std::string&, std::string&, int&, int&)'
note C:\Documents and Settings\Owner\Desktop\CodeBlocks\Take Home Final\menu.h:18 candidates are: void menu::initialize(std::string, std::string, std::string*, int*, int)
I just don't get it. It's that damn & sign again. I swear that one symbol is kicking my ass lately. I did a pretty thourogh(sp?) search and couldn't find anything, plus having tried various things for about 2 hours now... Can anybody help a poor soul out?