Hi, I am relatively new to C++, and as of now I'm just learning basic console programs using Visual C++ as a compiler. Anyways, I used the "Simple Win32 Program" option to turn one of my programs into a GUI, and I ran into a couple compiling errors. What do I need to do? Include windows.h?
Here is the code:
Code:
/* proj1.cpp : Defines the entry point for the application.
/* Full & Part Time Pay Calculator
 Asks user for hours worked and if they are a full or part time employee.
 It then calculates wages according to pay rates.
*/

#include "stdafx.h"
#include <iostream.h>
#include <iomanip.h>
#include <windows.h>

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{


int main()

	{
	double full = 4.50;
	double part = 4.00;
	int hours;
	double pay;
	int emp;

	cout << "How many hours?:";
	cin >> hours;
	cout << "\nFull or Part-Time?:\n";
	cout << "\nFull Time: 1\n";
	cout << "\nPart Time: 2\n";
	cin >> emp;

	cout.setf(ios::fixed);

	if (emp == 1)
		{
		if (hours <= 40)
			{
			pay = (hours * full);
			cout.setf(ios::fixed);
			cout << setprecision(2) << pay;
			}
		}
	else {
		pay = (hours * part) + (hours - 40 * (4.50 * 1.5));
		cout.setf(ios::fixed);
		cout << setprecision(2) << pay;
		}
	if (emp == 2)
		{
		pay = (hours * part);
		cout.setf(ios::fixed);
		cout << setprecision(2) << pay;
	}

	return 0;
	}
	






}
After compiling it I get these errors:
Configuration: proj1 - Win32 Debug--------------------
Compiling...
proj1.cpp
C:\Documents and Settings\Ken\My Documents\proj1\proj1.cpp(22) : error C2601: 'main' : local function definitions are illegal
C:\Documents and Settings\Ken\My Documents\proj1\proj1.cpp(68) : warning C4508: 'WinMain' : function should return a value; 'void' return type assumed
Error executing cl.exe.

proj1.exe - 1 error(s), 1 warning(s)
I would appreciate any help. Also, I would like to know when running the .exe with just basic console DOS windows, how do you get the window to stay open when it prints output? They usually just close so nobody can see it. Thanks again for helping a n00b out.