figuring out an error

I have an error problem I can't seem to figure out.

error message:

1>c:\documents and settings\student\my documents\visual studio 2008\projects\04shoemaker\04shoemaker\04shoemaker.cpp(9) : error C2447: '{' : missing function header (old-style formal list?)

code:

//programmer: Kelly Shoemaker
//program: 04Shoemaker.cpp
//purpose: Count Positive and Negative Values

#include <iostream>
using namespace std;

void main ();
{

cout << "Program Written By Kelly Shoemaker" << endl;

int i, v, p, n;
for (i = 1; i < = 10; i = i + 1);
{
cout << "Enter Integer Value: ";
cin >> v;

(v > = 0)?;
v = p p : n

cout << "Number of Positive Values: " << p << endl;
cout << "Number of Negative Values: " << n << endl;
}

system ("pause");
}




I am an extreme beginner
Did you add the #include "stdafx.h" ? I believe it is required in that IDE.
where would I place that within the code? after using namespace std; ?
when i do that it gives me this error:

1>c:\documents and settings\student\my documents\visual studio 2008\projects\04shoemaker\04shoemaker\04shoemaker.cpp(7) : fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
Last edited on
You have a semicolon ';' after your main() function head:

void main ();

That is a syntax error. Delete the semicolon:

void main ()

That should help :o)

You use a semicolon there when you are *declaring* a function but not when you are *defining* the function. That is, not when you are supplying the function body (the part in curly braces {}).
Last edited on
thanks!

now, i have these errors:

1>c:\documents and settings\student\my documents\visual studio 2008\projects\04shoemaker\04shoemaker\04shoemaker.cpp(14) : error C2059: syntax error : '='

1>c:\documents and settings\student\my documents\visual studio 2008\projects\04shoemaker\04shoemaker\04shoemaker.cpp(14) : error C2143: syntax error : missing ';' before ')'

1>c:\documents and settings\student\my documents\visual studio 2008\projects\04shoemaker\04shoemaker\04shoemaker.cpp(14) : error C2143: syntax error : missing ';' before ')'

1>c:\documents and settings\student\my documents\visual studio 2008\projects\04shoemaker\04shoemaker\04shoemaker.cpp(19) : error C2143: syntax error : missing ',' before ';'

it never ends, but i'll have to get used to it, it seems
Topic archived. No new replies allowed.