Hi i saw a post about this program already. im new to c++ and im lost... completely lost... im not even sure im posting this in the right place. anyways. the program i got is working correctly until i make it an OOP which is what my teacher wants us to do for every program we do. this is what i have so far.

// Menu Chooser.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <string>
#include<iostream>
	 
	 
using namespace std;

class MenuChooser
{
private:

public:
	MenuChooser(){

			int main()
{

cout << "Difficulty Levels\n\n";
cout << "1 - Easy\n";
cout << "2 - Normal\n";
cout << "3 - Hard\n\n";

enum level {easy = 1, normal = 2, hard = 3};
int choice;

cout << "Choice: ";

cin >> choice;

switch (choice)
{
case easy:

cout << "You choose Easy." << endl;
break;
case normal:

cout << "You choose Normal." << endl;
break;
case hard:

cout << "You choose Hard!!!" << endl;
break;
default:

cout << "You made an invalid choice!" << endl;

}

cout << "May the gods be with you!";

	}
};

	int _tmain(int argc, _TCHAR* argv[])
{
	 	Menu Chooser;
	return 0;
}

and i get this error.

1>c:\users\ceabear\desktop\c++\week 3 credit\menu chooser\menu chooser\menu chooser\menu chooser.cpp(64): fatal error C1075: end of file found before the left brace '{' at 'c:\users\ceabear\desktop\c++\week 3 credit\menu chooser\menu chooser\menu chooser\menu chooser.cpp(12)' was matched
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


i have no idea how to fix this. anyone?

i should of added that the other posting does not have the explenation about it being OOP which is the part im having issues with.

Why do you have two main functions?

Also, use code tags and check the line the error is identifying.

First thing is to format your code properly. That will prevent the errors you have now, never to return again. Well, almost never...

// Menu Chooser.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <string>
#include<iostream>
	 	 
using namespace std;

class MenuChooser
{
public:
MenuChooser()
{
cout << "Difficulty Levels\n\n";
cout << "1 - Easy\n";
cout << "2 - Normal\n";
cout << "3 - Hard\n\n";

enum level {easy = 1, normal = 2, hard = 3};
int choice;

cout << "Choice: ";

cin >> choice;

switch (choice)
{
case easy:
cout << "You choose Easy." << endl;
break;
case normal:
cout << "You choose Normal." << endl;
break;
case hard:
cout << "You choose Hard!!!" << endl;
break;
default:
cout << "You made an invalid choice!" << endl;
break;
}
cout << "May the gods be with you!";
}
};

int _tmain(int argc, _TCHAR* argv[])
{
MenuChooser menu;
return 0;
}
commented: Do NOT do people's work for them. You do not get their grade and they learn nothingl. -4

Is there any other problem with your code now?

Is there any other problem with your code now?

That code posted was not by the OP. That was simply another EGO post violating our don't do other's homework for them policy.

That code posted was not by the OP. That was simply another EGO post violating our don't do other's homework for them policy.

Ah, thanks for letting me know. I didn't notice that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.