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;
}

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

Thank you kind sir. I'm off to sleep.

You could also insert std::system("PAUSE"); between 18 and 19

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.