Newbie and my program

Hi guys, first post here. I am going to tell you that this is my upcoming lab assignment for tomorrow. I am simply trying it on my own first. We are just getting into c++ so I am a bit lost on debugging. I am also taking Java at the same time so the cross between is kinda strange. I am to calculate PI using (pi = 4 - 4/3 + 4/5 - 4/7 + ...). I wrote the following code and it won't build. The error I get is : error LNK2001: unresolved external symbol _WinMainCRTStartup. I am not to the point where I understand what this means. Any help is greatly appreciated. Here is my code thus far:


#include <iostream>

using namespace std;

int main()
{
int denominator = 3;
int terms = 30000;
double mypi = 4.0;
bool cond = true;

for ( int i = 1; i <= terms; i++ )
{
if (cond)
{
mypi = mypi - ( 4.0 / denominator );
}
else
{
mypi = mypi + ( 4.0 / denominator );
}
cond = !cond;
denominator = denominator + 2;

if ((i % 30) == 0)
{
cout << i << << mypi << endl;
}
}
return 0;
}


Thanks for the advice all.

Willis


Your project settings are wrong. You're trying to build as a win32 program instead of a console program.

Go in your project settings and look around for that option. I don't know exactly where it is.

If you can't find it, you can create a new project. This time be sure to pick "Console Application" from the list of project types when you do so.
Topic archived. No new replies allowed.