LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-04-2008, 07:31 PM   #1
Hotdog19
LQ Newbie
 
Registered: Mar 2008
Posts: 1

Rep: Reputation: 0
Compiling error


I am fairly new to coding, and I just can't figure out what I did wrong. It's a fairly simple assignment...


Code:
#include<iostream>
using namespace std;
 
int main() {
                
        double a, b, c, temp;
                
        cout << "Enter three numbers: ";
        cin >> a >> b >> c;
        if( a>b ) {
                temp = a;
                a = b;   
                b = temp;
}
        if( b>c ) {
                temp = b;
                b = c;
                c = temp;
}
        if( a>b) {
                temp = a;
                a = b;   
                b = temp;
}
 
        cout << a << " " << b << " " << c << endl;
        return 0 ;
}
The error is :

Code:
unix2% g++ -o sort3 sort3.cpp (Input)
sort3.cpp:8: error: parse error before numeric constant (Output)
 
Old 03-04-2008, 08:36 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Quote:
Originally Posted by Hotdog19 View Post
I am fairly new to coding, and I just can't figure out what I did wrong. It's a fairly simple assignment...

The error is :

Code:
unix2% g++ -o sort3 sort3.cpp (Input)
sort3.cpp:8: error: parse error before numeric constant (Output)
sure about that? it compiles fine on my machine. Maybe you didn't save before you last tried to compile?
 
  


Reply



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
Error when compiling kernel linux-2.6.22 : make: ***[_modinst_post] Error 137 ngoclan.it Linux - General 1 12-11-2007 06:54 AM
Error when compiling kernel linux-2.6.22 : make: ***[_modinst_post] Error 137 ngoclan.it Linux - Newbie 0 12-11-2007 06:49 AM
i get an error ./term.c :95 error conflicting types of tpam when compiling bitchx eveningblush Programming 0 03-30-2006 06:46 AM
Error compiling php 5.1 and also a fantastico error arachn1d Linux - Software 0 02-19-2006 04:52 PM
compiling error archish Linux - Software 0 12-27-2003 11:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:19 PM.

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