I am writing a small program in C++ and I need some help.

#include "iostream"
#include "string.h"

using namespace std;

void main(){
	string sman;
	
	cout << "Are you there? \n \n";
cin >> sman;

if(sman == "yes" || sman == "Yes"){
cout << "Screw that! \n \n";
	main();
}
	if(sman == "no" || sman == "No"){
		cout  << "Then my name is Pancaker The Random. \n \n";
		main();
	}
}

I am using Xcode and get the following error when I compile:

error: '::main' must return 'int'
Location line 6

Isn't it obvious?

Your main returns void (which is wrong)
The compiler tells you it must return int

So change it to int main and be done with it.

Why isn't this thread marked as solved?

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.