forums.xandros.com Forum Index forums.xandros.com
Xandros User Forums
 
 FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Begginer, need help with c++

 
Post new topic   Reply to topic    forums.xandros.com Forum Index -> Developer Tools
View previous topic :: View next topic  
Author Message
electronics45
Xandrosianding
Xandrosianding


Joined: 15 Apr 2004
Posts: 774
Location: Sydney, Australia

PostPosted: Sat Sep 24, 2005 2:37 am    Post subject: Begginer, need help with c++ Reply with quote

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. Mad

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
View user's profile Send private message Send e-mail Visit poster's website
Arne Anka
Xanspiration
Xanspiration


Joined: 21 Mar 2004
Posts: 4186
Location: Stockholm, Sweden

PostPosted: Sat Sep 24, 2005 3:49 pm    Post subject: Reply with quote

Are you trying to write a Linux virus or what ? Very Happy

I think

Code:

std::end1


should be

Code:

std:endl


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. Wink
Back to top
View user's profile Send private message
electronics45
Xandrosianding
Xandrosianding


Joined: 15 Apr 2004
Posts: 774
Location: Sydney, Australia

PostPosted: Sat Sep 24, 2005 7:51 pm    Post subject: Reply with quote

Thanks Arne Anka! Very Happy

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. Confused 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 ? Very Happy


err, not intentionally. Laughing Linux is pretty robust when it comes to viruses though, hopfully my system will stant up to my ignorance. Smile If I were to program on windows on the other hand... Twisted Evil
_________________
- Missing in action, as of 16-07-06
Farewell Xandros, and everyone in the fourms. It was a fun ride.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.xandros.com Forum Index -> Developer Tools All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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