UFO Project

I started writing my following code :

and I am getting the following error from the compiler. What should I change in the code?

$ g++ ufo.cpp ufo_functions.cpp
ufo_functions.cpp: In function ‘void display_misses(int)’:
ufo_functions.cpp:138:57: error: a function-definition is not allowed here before ‘{’ token
ame(std::string answer, std::string codeword)

Thanks :smile: in advance

#include "ufo_functions.hpp"

I have to imagine this will throw an error.

Maybe a bit late, but it seems you are trying to define the function end_game() within the funcion void display_misses()
The function display_misses should be closed with { (curly braces) before defining a new function.

This section in your code would look like:
std::cout << " / \ \n";
std::cout << " / \ \n";
std::cout << " / \ \n";


} //the curly brace I ment

void end_game(std::string answer, std::string codeword) {

if (answer == codeword) {

Hope this (still) helps.