Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-04-2004, 05:43 PM   #1
Senior Member
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537

Rep: Reputation: 87
test program

Hey everyone Im trying to Learn C++ programming and I have no prior experiance programming other then when I last tried to learn C++ programming in windows.

Im reading a book currently that has an example program that includes some empty lines to be printed

here is the code

#include <iostream.h> 
int main()
int x = 5;
int y = 7;
cout "\n";
cout << x + y << " " << x * y;
cout "\n";
return 0;

Now when I try and compile this in linux using the g++ compiler I get parse errors on lines 6 and 8 the two cout "\n";

It also complaines about iostream.h but thats because this program is using the old one and not the new one witch excapes me at the moment.

any help on why this is so I can continue learning without confustion ?

Last edited by exvor; 12-04-2004 at 05:45 PM.
Old 12-04-2004, 06:52 PM   #2
Senior Member
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537

Original Poster
Rep: Reputation: 87
Never mind i found what the problem was

they < in the book
forgot to use the <<

in the code above the cout "\n"; should have been cout << "\n";

I did this and it worked.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
5.1 audio test program Jamo Linux - Software 4 10-28-2005 09:01 PM
Hi, anyone want to test my program? twirl Programming 4 09-16-2005 07:54 PM
Is there a free program to test PC RAM? ChristophThoel Programming 3 11-01-2004 06:13 AM
looking for a program to test hardware mrtwice Linux - Hardware 6 12-04-2003 10:14 AM
compiling kino, gtk test program cant run vance Linux - Software 1 06-02-2003 05:36 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:50 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration