0

Hi,

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

isEven

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;
		cin.get();
	}
	
	string IsEven(string x)
	{
		if ( 100 / 3 % 2 == 0 ) return "even";
		else return "odd";
	}

Edited by marvolo1300: n/a

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by marvolo1300
0

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

Edited by caut_baia: n/a

0

Thank you very much. It worked!

void output () {
		cout << x;
		cin.get();
	}

Edited by marvolo1300: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.