hello all, im new here, ok, i have a question, im trying to make a simple program, but keet gettin an error

//NFL Favorite Team
#include <iostream>

int main()
{
	int NFL;

	std::cout << "Who is the best team in the NFL?\n";
	std::cout << " (please only use the first three letters in the teams name *not city*)\n";

	std::cin >> NFL >> endl;

	if (NFL=Ste)
		std::cout << "We Have a Winner!!!! *claps*\n";
	else
		std::cout << "How wrong could you be? Have you ever heard of a little team called the STEELERS?!\n";
	return();
}

i keep gettin this error

unexpected end of file while looking for precompiled header directive
using visualC++.net (visualC++6)

(sry for the double post*i wanted to edit*)

Does anyone know y i keep gettin this error?

>unexpected end of file while looking for precompiled header directive

Turn off precompiled headers if you're not using them.
[IMG]http://img33.exs.cx/img33/3041/precompiledheaders0go.jpg[/IMG]

But by all means, visit some basic tutorials or back up to the beginning of your book first.

thnx... now im gettin this....

c:\C++STUFF\NFL\NFL.cpp(13) : error C2065: 'Ste' : undeclared identifier
c:\C++STUFF\NFL\NFL.cpp(17) : error C2059: syntax error : ')'

NFL - 4 error(s), 0 warning(s)

when i tried posting the errors, i got that it was to many pictures...

can anyone please help me?

But by all means, visit some basic tutorials or back up to the beginning of your book first.

I already tried. You are really lacking on some of the basics. Perhaps you might have specific questions? If these error messages are confusing you, my previous advice ought to be followed first.

[edit]What number is Ste, for example?

Represents a minimum change to your code, changing NFL to a string and making a string compare in the if statement:

// Dev C++

#include <cstdlib>     // system()
#include <iostream>

using namespace std;   // std::cout, std::cin

int main()
{
	char NFL[20];

	cout << "Who is the best team in the NFL?\n";
	cout << " (please only use the first three letters in the teams name *not city*)\n";

	cin >> NFL;

	if (strcmp(NFL,"Ste") == 0)
		cout << "We Have a Winner!!!! *claps*\n";
	else
		cout << "How wrong could you be? Have you ever heard of a little team called the STEELERS?!\n";

  system("PAUSE");  // wait
  return 0;
}

P.S. VC++ 6 is not VC++ .NET...

+ <iostream> should be <iostream.h> UNLESS you have "using namespace std;" somewhere, and if you use <iostream.h> you can lose the "std::" bits.
+ you have return() and not "return 0;"
+ you are also trying to compare a string and a number (if(NFL=Ste))
+ and to check something is equal you need to use "==" not "="

btw vegaseat's code is what to aim for and will work in vc++

+ <iostream> should be <iostream.h> UNLESS you have "using namespace std;" somewhere, and if you use <iostream.h> you can lose the "std::" bits.

No, you should not use <iostream.h>, which became obsolete in 1998. You should use <iostream>, but this requires using the std namespace for things you use that are in it.

+ you have return() and not "return 0;"

It was correct as is, your correction is not.

int main(void)
{
return ();
}

is correct ?!?!?

never seen that before...

and what is the difference between iostream and iostream.h as i dont notice any compiling on dev c++

int main(void)
{
return ();
}

is correct ?!?!?

Uh, no. :o My bad.

I thought you were advocating return() as opposed to return 0. I didn't look at the post you were replying to -- I just saw the one from vegaseat.

no problem. whats the deal with <iostream> thought?? i always use <iostream.h> as i dont have to remember to put std:: (or forget to and get errors) before everything...

no problem. whats the deal with <iostream> thought?? i always use <iostream.h> as i dont have to remember to put std:: (or forget to and get errors) before everything...

I don't know the exact history of C++'s standardization, so I'll give you my synopsis and hope someone will not tell me it's completely wrong.

C++ was standardized in 1998. Before then it existed and there were compilers for it. Since it was based on C, it looked very much like it at first. So pre-standard headers "guessed at" <iostream.h>, etc.

Along the way to standardization, namespaces were introduced. To support existing code as best possible, but use the namespaces as intended, the new header files were invented as the happy middle ground.

Since the initial guess of <iostream.h> was not the correct one, it's best to stop using it before the code you write is not supported by the compiler you are using. (And I believe it is true that the newer MS offering has ended support for the non-standard <iostream.h>.)

I'm sure if you felt like hours of googling, you could find much better and accurate information.

i get it. I thought the standardisation was AGES before 1998!!!!!! i assumed the language was older than that. <iostream.h> works for me. Ill have to look for namespace tutorials... :(

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.