0

Last question for today before you start hating me.. I don't know if this really belongs here, but I'll post here anyway.

How do I make my programs stay on command prompt longer? Usually they just flash for a second if I don't open them up with command prompt. Heres the program I want to stay longer on screen.

#include <iostream>
using std::cout;
using std::cin;
int poop (int first, int second)
{
    return (first + second);
}
 
 
int main()
{   
    cout << "SHES A GONNA GIVE BIRTH!\n";
    int a, c, e;
    cout << "Enter two numbers: ";
    cin >> c;
    cin >> e;
    a=poop (c,e);
    cout << "Look at your wonderful baby. Isn't she numberish?" << a;
    return 0;
}
4
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by William Hemsworth
0

put this:

std::cin.ignore();
std::cin.get();

between lines 18 & 19.

your program will now wait for a " \n" (enter) to be pressed before exiting.

for a more detailed solution (and better) look here

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.