Is a function definition not allowed here before a ‘{‘ token?

You are declaring the function bodies inside the main function, which is not valid. Also you’ve been using too many ‘}’-s.

Your code should look more like this:

#include<iostream>
using namespace std;

const int MAX_ITEMS = 100;

bool running = 1;

int playerInfo[2];

void titleFunc();

int userInput = 0;
int playerLocation = 0;

void newGameFunc();

void titleFunc() {
    cout << "\t\t\t\t---Fantasee---\n\n\n";
    cout << "\t\t\t\t     1:Play\n";

    cin >> userInput;

    if (userInput == 1) {

        newGameFunc();

    }
    else {
        running = 0;
    }
    return;
}

void newGameFunc() {

Leave a Comment