1

I've just started learning C++, and I'm having some problems running my programs. Even when I just copy the source code from my C++ tutorial book:

//-----------------------------------------------------
//
// add.cpp
//
// Program for adding two whole numbers
//
#include <iostream>
using namespace std;
int main ()
{
    int number1;
    int number2;
    int sum;
    
    cout << "Write two whole numbers with a space between them: ";
    cin >> tall1 >> tall2;
    sum = tall1 + tall2;
    cout << "The sum is: " << sum << endl;
    return 0;
} // main

The program starts, and lets me type in two numbers, but when I hit 'enter' it shuts down and disappears.
(I use "Dev-C++" compiler)

Votes + Comments
Nice, code tags on the first post - keep up the good work :)
4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by NathanOliver
0

Thank you for using code tags, but The Member Rules state "Do not post threads with generic subjects such as "HELP ME" or "PROBLEM". Instead, clearly state a phrase describing the problem as the thread's title." Please post proper titles next time.

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.