"blank" must return a value?

I am creating a story based program but having an error? When I compile I am getting a "middle" must return a value error. How can I fix this?

main.cpp file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "Header.h"

int main() {
	string name, weapon, monster;
	int choice;
	story();
	cout << "Enter a name " << endl;
	cin >> name;
	introduction(name);
	cout << "What weapon do you have?" << endl;
	cin >> weapon;
	cout << "What monster will you fight?" << endl;
	cin >> monster;
	cout >> middle(weapon, monster);
	cout << "Enter a number between 1 and 3 " << endl;
	cin >> choice;
	cout << end(choice);
}


functions.cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "Header.h"

void story()
{
    cout << "once upon a time....." << endl;
}
void introduction(string name)
{
    cout << "There was a hero called " << name << endl;
}
string middle(string a, string b) 
{
    cout << "They had a " << a << "and killed a " << b << "using it" << endl;
}
string end(int choice)
{
    switch (choice)
    {
    case 1: return "That is all! \n";
    case 2: return "This is the tale that never ends \n";
    case 3: return "Think of an ending yourself";
    default: return "Can't you manage to follow instructions?";
    }
}


Header.h

1
2
3
4
5
6
7
8
9
10
11
#pragma once
#include<iostream>
#include<iomanip>
#include<string>

using namespace std;

void story();
void introduction(string name);
string middle(string a, string b);
string end(int choice);
function middle, of type string, must return a string.
or, you can make it type void, and it can return nothing as it is now.
Topic archived. No new replies allowed.