Compiling/Executing Source.

This is a discussion on Compiling/Executing Source. within the C++ Programming forums, part of the General Programming Boards category; I use the Dev-C++ and have tried Borland and whenever I compile, even a hello world application, a source, any ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    60

    Compiling/Executing Source.

    I use the Dev-C++ and have tried Borland and whenever I compile, even a hello world application, a source, any source, something goes wrong in runtime; such as the DOS-Command Prompt flashing when I use the std::cout, or cout, option or sending a blank DOS window when I ask to int a variable, cout Type an integer, cin an input, and cout the input. Is there anyway around this?

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    60
    But that doesn't work with variables and I've seen other people make it work without cin.get();

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Well explain your problem better because honestly it doesn't make a lick of sense. All I was able to extract from it was "can't get my window to stay open"

  5. #5
    Registered User
    Join Date
    Jul 2004
    Posts
    60
    Code:
    #include <iostream.h>
    
    int main()
    {
         int num;
         cout<<"Input an integer.";
         cin>>num;                                            //Do I have to use cin.get() here?
         cout<<"You inputted "<<num;
      return 0;
    }
    What happens is a blank DOS window comes up that's not queuing my response and is just using a get()-liike manner to wait patiently.
    Last edited by C++Child; 07-07-2004 at 07:28 AM.

  6. #6
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    so you do not get a prompt that says "Input an interger."?

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,801
    Try
    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    	int num;
    	cout<<"Input an integer.";
    	cin>>num;
    	cout<<"You inputted "<<num<<endl;
    	return 0;
    }
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debug into Source
    By lehe in forum C++ Programming
    Replies: 4
    Last Post: 02-18-2009, 09:45 AM
  2. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  3. Open Source Licenses
    By Mario F. in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 10-10-2006, 08:53 PM
  4. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 08:40 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21