![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Sexy Programmer
|
A novice programmer should in no way try to change the language that one is programming in. It will cause confusion and unjust practices.
__________________
I would love to change the world, but they won't give me the source code! |
|
|
|
|
|
#12 |
|
Programmer
Join Date: May 2006
Posts: 85
Rep Power: 3
![]() |
I agree you should get used to using the code and not rely on the compiler. Some compilers require you to use more code for example in some programs that you write in Dev-C++ in some programs you need to include things like cin.get() and system ("PAUSE") they might be needed for some programs to work... They are just a few problems that I have come accrost (I dont know if I spelled that right lol) in my programming with Dev-C++
__________________
Code Forums |
|
|
|
|
|
#13 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5
![]() |
As a matter of fact, both the 1999 C standard and the C++ standard specify that falling off the end of main() [i.e. reaching the curly brace] is the same as returning zero. The ARM specified the same thing, so all C++ compilers (whether they predate the ISO C++ standard or not) should handle falling off the end of main() correctly. I'm not sure offhand, but suspect the 1989 C standard specifies the same thing.
There was definitely an issue with pre-standard C compilers: the behaviour on falling of the end of main() was unpredictable. So, if you have a C compiler that predates the 1989 C standard ..... Coming back to the original problem, proudnerd, linker errors usually mean that you haven't specified enough libraries on the command line. Or it might mean that some environment variables (which specify what directories the linker should look in for library files) ar not set correctly. |
|
|
|
|
|
#14 |
|
Newbie
Join Date: May 2006
Posts: 21
Rep Power: 0
![]() |
I'm sorry to bother you with my newbie-ness, but here's another code problem for you guys to help me with (and this time I'll include the errors
).#include <iostream>
using namespace std;
int main()
{
int favNumber;
cout << "What's your favorite number? ";
cin >> favNumber;
if (favNumber == 13);
{
cout << "Hey, that's my favorite number, too!\n";
}
else;
{
cout << "That's not my favorite number, but oh well.\n";
}
return 0;
}I get these two errors: error: expected primary-expression before "else" error: expected `;' before "else" |
|
|
|
|
|
#15 |
|
Expert Programmer
|
Try removing the ; after else.
|
|
|
|
|
|
#16 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 770
Rep Power: 3
![]() |
also the one after if(favNumber == 13)
|
|
|
|
|
|
#17 |
|
Newbie
Join Date: May 2006
Posts: 21
Rep Power: 0
![]() |
Thank you so much. It works perfectly now!
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|