Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-25-2005, 12:00 AM   #1
LQ Newbie
Registered: Mar 2005
Location: Mumbai
Posts: 5

Rep: Reputation: 0
how to show input and output of a program on the terminal


int main()
int a;

in anjutha ide when we execute this code the terminal pops up and the input is given and output of the program is shown .

I want to know that how can i do this for a program as i also want the user to give the input and output in a newly opened terminal

How to do this
I tried
$ gnome-terminal a.out
but terminal exits immediately.

i.e the ./a.out command should work in a newly opened terminal
but it does not happen

please help me if you can

Old 03-25-2005, 01:19 AM   #2
Mega Man X
LQ Guru
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 64
Hi divin!

I'd like to give your some tips. First, change your code a bit, iostream.h library was deprecated for several years. Use "using namespace std" instead. Here is an example of the above code:

#include <iostream>
using namespace std;
int main (void)
    int someInput;
    cin >> someInput;
    cout << someInput;

    return 0;
I'm assuming that you've saved this file as Compile it with g++, like this:

g++ -o program

That would create an executable file called "program". Execute it with "./program". That should work.

Good luck!


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
Redirect terminal output to file AND terminal shan Linux - General 3 09-29-2006 09:36 AM
dd: input/output error? logosys Linux - Newbie 3 09-19-2005 03:13 AM
recording terminal input and output babyphil Linux - Newbie 4 08-29-2004 11:22 PM
Input / output error xviddivxoggmp3 Slackware 22 08-24-2004 01:47 PM
Exercise 1-9. Write a program to copy its input to its output, replacing each string zombi3 Programming 3 12-21-2003 03:28 AM

All times are GMT -5. The time now is 10:59 PM.

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