I have a bit of a problem with the following code. It won't compile, giving a couple of errors (semi-colons missing that I can't track down, class not found etc)
The main problem I think is that for some reason, there is not object created.
The sad thing is, it's not even that big of a code. Must be going blind.
//main.cpp
#include <iostream>
#include <string>
//header files
#include "lotto.h"
//declare functions:
void menuLottoPrint();
int main ()
{
menuLottoPrint();
};
void menuLottoPrint()
{
lotto oLotto;
int menuLottoChoice = 0;
std::cout << "This is a Quick Pick generator for a Lotto \n""What sort of lotto would you like to play ? \n""1. Lotto \t 2.SuperLotto \t 3.Euromillions \n";
std::cin >> menuLottoChoice;
oLotto.menuLottoOption(menuLottoChoice);
};
#ifndef L_H
#define L_H
class lotto
{
public:
lotto(); //you technically don't need this but I don't see where mType is being initialized.
void menuLottoOption(int option);
private:
int mType;
};
#endif
Compiles for me without those semi-colons, though I did put all the code into one file. What is the exact error you receive.
EDIT: Change menuLottoPrint to
1 2 3 4 5 6 7 8 9 10
void menuLottoPrint()
{
lotto oLotto;
int menuLottoChoice = 0;
std::cout << "This is a Quick Pick generator for a Lotto \n"
<<"What sort of lotto would you like to play ? \n"
<<"1. Lotto \t 2.SuperLotto \t 3.Euromillions "<<std::endl;
std::cin >> menuLottoChoice;
oLotto.menuLottoOption(menuLottoChoice);
}
Main.cpp:
C2065: 'oLoto' undeclared identifier. (line 24)
C2146: syntax error: missing ';' before identifier 'oLotto' (line 18)
C2653: 'lotto' : is not a class or namespace. (line 4)
The other are related to the data members and methods not found.
Basically, it just won't let me create the object, even though they are included