For an exercise we are supposed to:

Write a C++ program that uses three user-defined functions (counting main () as one) and produces the following output:
Three blind mice Three blind mice See how they run See how they run
One function, called two times, should produce the first two lines, and the remaining function, also called twice, should produce the remaining output.

so far this is what I was able to come up with but I can't understand why it isn't working! I just started C++ last week and I'm completely lost..

#include <conio.h>
#include <iostream>
using namespace std;

int main()
{
    int threemice();
    int threemice();
    int seehow();
    int seehow();
    getch();
    return 0;
}

int threemice()

{
    cout << "Three blind mice" << endl;
}

int seehow()

{
    cout << "see how they run" << endl;
}

There is a bunch of stuff wrong with this code. First is that you DON'T write the functions return type in main. Here you wrote a declaration of the function (or whatever its called :p) Also you need to define functions before main OR write what you did in main instead. Also your functions do not return anything so there return type should be void. First try reading a good tutorial or a book about c++.
This is correct version:

#include <conio.h>
#include <iostream>
using namespace std;

void threemice();
void seehow();

int main()
{
threemice();
threemice();
seehow();
seehow();
    getch();
    return 0;
}

void threemice()
{
    cout << "Three blind mice" << endl;
}

void seehow()

{
    cout << "see how they run" << endl;
}

Or at least this:

#include <conio.h>
#include <iostream>
using namespace std;
int seehow();
int threemice();

int main()
{
threemice();
threemice();
seehow();
seehow();
    getch();
    return 0;
}

int threemice()
{
    cout << "Three blind mice" << endl;
}

int seehow()

{
    cout << "see how they run" << endl;
}

Also why do you have getch here? It is not neccessery and conio is non-standard library so you should not use it that much.

for your functions to work, you have to declare them before the main... as the compiler will make a checklist of what it has seen before while compiling the program from top to bottom, so when it sees a function, it checks for it in its checklist if its seen a declaration before.
sergent has posted what I was about to post, so I withdraw

we use the keyword void, because the function is not expected to return anything to the program...
When funtions are declared, they are first preceeded by their return value. In this case void means nothing Just do something for me here but don't give me anything

Also when using functions don't write void. Then compiler should ignore them or give an error

Thank you guys! thanks for the helpful advice! BTW I am using getch() in there because I don't want to use system("pause") which leaves the annoying "press any key to continue"

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.