|
|
#1 (permalink) Top |
|
Alpha Geek
![]() Join Date: Apr 2004
Age: 20 Male
Posts: 2,270
Times Helpful: 51
My Mood: Angelic
Status: Offline
|
Starting to learn C++, seems like a fairly good learning curve.
Anyway, ran in to an error when using code from a book: PHP Code:
then i read about using std::end1; - PHP Code:
E2316 'end1' is not a member of 'std' in function main() at line xx Suggestions why? |
|
|
|
|
#2 (permalink) Top |
|
The King
![]() ![]() Join Date: Jan 2004
Age: 18 Male
Posts: 5,254
Times Helpful: 402
My Mood: Drunk
Status: Offline
|
Waffle, the endline function is spelt with an l at the end, not a 1.
So the statement would be: Code:
cout << "testing testing" << endl; cout << "New line this is"; cin.get(); //waits for user input Code:
using namespace std;
__________________
Never trust a program you don't have the source code for. ![]() My website | Powerful Desktop Linux | Linux for human beings | Linux for power users | Linux for ricers |
|
|
|
|
#4 (permalink) Top | |
|
It's D Grav80 Of Luv
![]() Join Date: Jan 2006
Age: 23 Male
Posts: 3,460
Times Helpful: 160
My Mood: Cool
Status: Offline
|
Quote:
using "getch();" command will help in getting out of your program.....just use it in your function at the end.....
__________________
__________________________________________________ ___ Troubleshoot a Dead/Unbootable PC / Microsoft Events Viewer![]() Troubleshoot Printer / Most Common Home Audio Problems_
|
|
|
|
|
|
#5 (permalink) Top |
|
The King
![]() ![]() Join Date: Jan 2004
Age: 18 Male
Posts: 5,254
Times Helpful: 402
My Mood: Drunk
Status: Offline
|
Karanislove, using
PHP Code:
__________________
Never trust a program you don't have the source code for. ![]() My website | Powerful Desktop Linux | Linux for human beings | Linux for power users | Linux for ricers |
|
|
|
|
#6 (permalink) Top |
|
It's D Grav80 Of Luv
![]() Join Date: Jan 2006
Age: 23 Male
Posts: 3,460
Times Helpful: 160
My Mood: Cool
Status: Offline
|
I never had any problem with this function using Visual Studio 2003.net
__________________
__________________________________________________ ___ Troubleshoot a Dead/Unbootable PC / Microsoft Events Viewer![]() Troubleshoot Printer / Most Common Home Audio Problems_
|
|
|
|
|
#7 (permalink) Top |
|
The King
![]() ![]() Join Date: Jan 2004
Age: 18 Male
Posts: 5,254
Times Helpful: 402
My Mood: Drunk
Status: Offline
|
Thats because the VC++ compiler allows it, but if you want to build portable applications, its better to use standard ANSI C++ code.
__________________
Never trust a program you don't have the source code for. ![]() My website | Powerful Desktop Linux | Linux for human beings | Linux for power users | Linux for ricers |
|
|
|
|
#8 (permalink) Top |
|
Banned
Join Date: Aug 2006
Posts: 153
Times Helpful: 20
My Mood: Amused
Status: Offline
|
I like void main() as well.
its endl instead of end1 because the L stands for line. Also you should include the library extension. For instance <iostream.h> Why are you learning C++? It's dated. Move on to C#. |
|
|
|
|
#9 (permalink) Top | ||
|
The King
![]() ![]() Join Date: Jan 2004
Age: 18 Male
Posts: 5,254
Times Helpful: 402
My Mood: Drunk
Status: Offline
|
Quote:
Code:
In file included from /usr/lib/gcc/i586-mandriva-linux-gnu/4.0.1/../../../../include/c++/4.0.1/backward/iostream.h:31,
from voidmain.c:1:
/usr/lib/gcc/i586-mandriva-linux-gnu/4.0.1/../../../../include/c++/4.0.1/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
voidmain.c:5: error: '::main' must return 'int'
Quote:
Why use the Unix security system when its dated and Windows is newer?
__________________
Never trust a program you don't have the source code for. ![]() My website | Powerful Desktop Linux | Linux for human beings | Linux for power users | Linux for ricers Last edited by Addis; 22-12-2006 at 10:05 PM. |
||
|
|
|
|
#10 (permalink) Top |
|
Supreme Geek
![]() Join Date: Jan 2003
Age: 27
Posts: 1,638
Times Helpful: 16
My Mood: Sick
Status: Offline
|
You can also use \n inside your quotation marks (the "new line" character), it makes the code easier to read and faster to write.
\t for tabulations, as an FYI. I understand c++ is much more powerful, but with Java you get the API for free, which is quite useful. After learning it a bit moving to c++ will be easier. |
|