DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 8 of 8

Thread: window closes

  1. #1
    Join Date
    Sep 2004
    Posts
    63

    window closes

    When I run this program:
    # include <iostream.h>
    int main() {
    cout<< "abcd\n";
    cout<< "Liczba znaków w \"abcd\" = " <<sizeof "abcd";
    cout<< "" << endl;
    cout<< " Wyrazy przedzielone\t tabulatorem" << "\n";
    cout<< " Tekst dwuwierszowy \
    w jednym wierszu" ;
    }

    window closes itself quickly after the program shows the text.
    What should I do to be able to read the text and close the window clicking at the right corner. I use Bloodshed Dev C++ 5 beta 9 release (4.9.9.0) compiler.
    Thank you in advance.

  2. #2
    Join Date
    Dec 2003
    Posts
    3,366
    either run it from a "dos box" by start->run->cmd (command on win 98)

    or
    add
    system("pause"); to your code at the end

  3. #3
    Join Date
    Nov 2003
    Posts
    4,118
    In addition to jonnin's suggestions, you can also read a dummy char to delay output:

    //place this code at the end
    char dummy;
    cin>>dummy;
    Danny Kalev

  4. #4
    Join Date
    Apr 2004
    Posts
    136
    system("pause");
    return (0);
    }


    error C2065: 'system' : undeclared identifier


    :confused:

  5. #5
    Join Date
    Dec 2003
    Posts
    3,366
    #include <something> ... look in your help... I don't know what it is, cstdio maybe?

  6. #6
    Join Date
    Nov 2003
    Posts
    4,118
    <cstdlib>
    Danny Kalev

  7. #7
    Join Date
    Sep 2004
    Location
    Pune
    Posts
    6
    you can even use getch() function from conio.h before return(0)
    Viraj

  8. #8
    Join Date
    Oct 2004
    Posts
    3
    right before the return 0;
    put


    cin.get();
    return 0;
    }

    then u have to hit enter to close it, its worked pretty well for me

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links