Hello & Welcome to our community. Is this your first visit? Register
Follow us on
Follow us on Facebook Follow us on Twitter Watch us on YouTube


MMOCoin

Likes Likes:  0
Results 1 to 6 of 6

Hybrid View

  1. #1
    Banned

    Join Date
    Sep 2009
    Posts
    90
    Post Thanks / Like
    Rep Power
    0
    Reputation
    103
    Quote Originally Posted by Synapse View Post
    Let's take this program as an example:

    Code:
    // This programs converts feet to metres or vice versa
    
    #include <iostream>
    using namespace std;
    
    int main ()
    {
        short userchoice;
        double metres;
        double feet;
    
        cout << "To convert feet to metres, please press 1\n";
        cout << "To convert metres to feet, please press 2\n";
        cin >> userchoice;
        cout << "\n";
    
        if (userchoice == 1)
        {
            cout << "Please enter the number of feet: ";
            cin >> feet;
            metres = feet/3.28;
            cout << feet << " feet = " << metres << " metres\n";
        }
    
        if (userchoice == 2)
        {
            cout << "Please enter the number of metres: ";
            cin >> metres;
            feet = metres*3.28;
            cout << metres << " metres = " << feet << " feet\n";
        }
    
        cout << "\n";
        system("PAUSE");
        return 0;
    }
    In this case, a pause is needed after displaying the result or else the program would instantly close without allowing the user to see it. Should I stick to 'system("PAUSE")' for simple programs?
    I suggest that you download Visual Studio, since you don't need to pause the program if you use it.
    To run the program simply press ctrl + F5




  2. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

  3. #2
    Beginner

    Join Date
    Feb 2010
    Posts
    24
    Post Thanks / Like
    Rep Power
    16
    Reputation
    3
    Thanks for the tip mate!

 

 

Visitors found this page by searching for:

pausing a program in c

pausing visual studio without system(pause)

I need system pause for visual studio to run program

efficient ways of pausing program

c pausing program without system pause

pause c program in visual studio

SEO Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -5. The time now is 03:47 AM.
Powered by vBulletin® Copyright ©2000-2025, Jelsoft Enterprises Ltd.
See More links by ForumSetup.net. Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
vBulletin Licensed to: MMOPro.org