Z
Zack Wahab
Hi,
I use Dev C++ compiler. Tried this program :
// Fig. 1.6: fig01_06.cpp
// Addition program.
#include <iostream>
// function main begins program execution
int main()
{
int integer1; // first number to be input by user
int integer2; // second number to be input by user
int sum; // variable in which sum will be stored
std::cout << "Enter first integer\n"; // prompt
std::cin >> integer1; // read an integer
std::cout << "Enter second integer\n"; // prompt
std::cin >> integer2; // read an integer
sum = integer1 + integer2; // assign result to sum
std::cout << "Sum is " << sum << std::endl; // print sum
// indicate that program ended successfully
} // end function
The window prompt to enter the integers.However, the result was not
displayed. Instead, immediately it comes back to the compiler program
(The command Prompt window immediately turn off). Is it something to
do with the compiler? I tried to find the button for enabling output
result but couldn't find one..
I use Dev C++ compiler. Tried this program :
// Fig. 1.6: fig01_06.cpp
// Addition program.
#include <iostream>
// function main begins program execution
int main()
{
int integer1; // first number to be input by user
int integer2; // second number to be input by user
int sum; // variable in which sum will be stored
std::cout << "Enter first integer\n"; // prompt
std::cin >> integer1; // read an integer
std::cout << "Enter second integer\n"; // prompt
std::cin >> integer2; // read an integer
sum = integer1 + integer2; // assign result to sum
std::cout << "Sum is " << sum << std::endl; // print sum
// indicate that program ended successfully
} // end function
The window prompt to enter the integers.However, the result was not
displayed. Instead, immediately it comes back to the compiler program
(The command Prompt window immediately turn off). Is it something to
do with the compiler? I tried to find the button for enabling output
result but couldn't find one..