 |
forums.xandros.com Xandros User Forums
|
| View previous topic :: View next topic |
| Author |
Message |
electronics45 Xandrosianding

Joined: 15 Apr 2004 Posts: 774 Location: Sydney, Australia
|
Posted: Sat Sep 24, 2005 2:37 am Post subject: Begginer, need help with c++ |
|
|
Hi
I've got a fabulous new C++ programming book, Which I chose becuse it doesn't focus on any particular platform, an is very comprehensive.
But wouldn't you know it, I'm already geting compiling errors on the second example.
Here's what the output I get;
| Quote: |
andreas@Andreas:~/programs/second$ g++ prog2.cc -o prog2
prog2.cc: In function `int main()':
prog2.cc:4: error: `end1' undeclared in namespace `std'
prog2.cc:8: error: `end1' undeclared in namespace `std'
|
Here's my source;
| Code: |
#include <iostream>
int main ()
{
std::cout << "Enter two numbers:" << std::end1;
int v1, v2;
std::cin >> v1 >> v2;
std::cout << "the sum of " << v1 << " and " << v2
<< " is " << v1 + v2 << std::end1;
return 0;
}
|
_________________ - Missing in action, as of 16-07-06
Farewell Xandros, and everyone in the fourms. It was a fun ride. |
|
| Back to top |
|
 |
Arne Anka Xanspiration

Joined: 21 Mar 2004 Posts: 4186 Location: Stockholm, Sweden
|
Posted: Sat Sep 24, 2005 3:49 pm Post subject: |
|
|
Are you trying to write a Linux virus or what ?
I think
should be
i.e. number one should be replaced with lower case letter L (endl = end of line). You can also optionally leave out the prefix std::. At least that was the case last time I wrote a C++ program (a couple of years ago).
Happy hacking.  |
|
| Back to top |
|
 |
electronics45 Xandrosianding

Joined: 15 Apr 2004 Posts: 774 Location: Sydney, Australia
|
Posted: Sat Sep 24, 2005 7:51 pm Post subject: |
|
|
Thanks Arne Anka!
Its working great now. I just had to replace my 1's with l's, and its working now. But even when I go back over the book, There ones and L's are almost identical in that font. I can see myself making this mistake again soon.
I left the double colen in, and it still works fine.
| Quote: | Are you trying to write a Linux virus or what ? |
err, not intentionally. Linux is pretty robust when it comes to viruses though, hopfully my system will stant up to my ignorance. If I were to program on windows on the other hand...  _________________ - Missing in action, as of 16-07-06
Farewell Xandros, and everyone in the fourms. It was a fun ride. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|