I'm just trying out something with returning values to a variable and I've encountered a problem.

Basically the program is supposed to return the value of

string x

as either true or false from the


function, then the

void output

function should output the value of

string x

The problem is that at line 8, my IDE says,

ERROR: expected a declaration

The code :

#include "stdafx.h"
#include "stdio.h"
#include <iostream>

using namespace std;

	void output {
		cout << x;
	string IsEven(string x)
		if ( 100 / 3 % 2 == 0 ) return "even";
		else return "odd";

You need a pair of brackets even if you don't provide arguments for a function. ;)

Thank you very much. It worked!

void output () {
		cout << x;
Be a part of the DaniWeb community

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