Im having trouble fixing this error on my program. Any help would be greatly apprecitated.

#include <iostream>

using namespace std;

 int main ()
 
 {
	char choice;
	
                cout<<" Is it after 12 noon? (y/n)" <<endl;
	cin>>choice;
	
                if (choice == 'y') 
	cout<<" Good afternoon, world!"<<endl;
	
	else if
	(choice == 'n')
	cout<<" Good morning, world!"<<endl;
	
	else 
	cout<<" Good day, world!"<<endl;
	
	return 0;
}

Thank You Very Much.

what exactly is you error?

It compiles fine for me.
If your using Visual Studio (or Visual C++) Make sure that your project is a Windows (win32, win64) console application, not a standard windows application.
This option is selected when you make the new project.

The only error in this file is horrible formatting. The program compiles and runs just fine.

Thank you all.
Darth PJB you were right. I believe I had accidently put standard window application rather than console application.
Necrolin, I’m sorry my formatting is not pleasing to you. im fairly new to programming, but thank you for the constructive criticism.

Thank you all.
Darth PJB you were right. I believe I had accidently put standard window application rather than console application.
Necrolin, I’m sorry my formatting is not pleasing to you. im fairly new to programming, but thank you for the constructive criticism.

Not a problem, It's a common mistake. Most programming IDE's (like visual studio, code blocks, etc) Have certain project types that have certain properties defined. Any true Window application doesn't start from 'main()', but rather 'winMain()'. This is quite debatable due to that not really being ansi standard C++. However Microsoft rule us with an iorn fist.

As for formatting while by technicality it doesn't actually matter (c++ ignores whitespaces) it's generally good practice only to indent things when inside a block (if, loops, functions), or where doing so makes the program much clearer to read.

Good luck anyhow ^_^.

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.