views:

518

answers:

5

I'm trying my hand at c++ and am using fedora eclipse (3.4.2) as my IDE.

At the moment I'm trying to enter a string of numbers into the console, get the program to sort them and spit them back out. The program is straight out of a book and works with xcode and through a normal terminal - so I know it's correct.

Basically I run the program and enter a few numbers into the eclipse console, the numbers are coloured green so I know its accepting the input correctly.

When I hit enter, the console jumps to a new line and nothing happens. When I press control+shift+D, nothing happens. When I press control+d, nothing happens.

I use eclipse for python too, and the console works properly. Just hitting enter inputs data to the program.

Am I missing something here? I've spent the last half hour or so trying to figure this out. Can anyone help me? Thanks.

A: 

Without seeing any code, we can't really help you, code please :)

Lanissum
A: 

The fact that you copied the code from a book doesn't mean it can't contain errors. Please post the source :)

Merkoth
A: 

How does your program know that input has ended? It sounds like it accepts multiple lines of input in the console window. Isn't there some magic case that pops you out of that loop so you can process the input that's been collected? As other said, without the code there's no answer.

Doug Boone
A: 

where is the code?

ragsagar
+1  A: 

What version of ecplise and what complier are you using? The following worked for me on Eclipse Ganymede with GCC version 3.4.5:

#include <iostream>
using namespace std;

int main() {
    int x = 0;
    cout << "Type your input here:";
    cin >> x ;
    cout << "You entered " << x << endl;
    return 0;
}
Sai Charan