Quote:
Originally Posted by debleena_doll2002 View Post
first sol :
Code: cpp
#include <iostream.h>
int main()
{
   int integer1, integer2, sum;

   cout << "Enter first integer\n";
   cin >> integer1;
   cout << "Enter second integer\n";
   cin >> integer2;
   sum = integer1 + integer2;
   cout<<"Sum is " <<sum<< endl;
   return 0;
}


second solution:
Code: cpp
#include <iostream>
using namespace std;

int main()
{
   int integer1, integer2, sum;

   std::cout << "Enter first integer\n";
   std::cin >> integer1;
   std::cout << "Enter second integer\n";
   std::cin >> integer2;
   sum = integer1 + integer2;
   std::cout<< "Sum is " << sum << endl;
   return 0;
}
You are not suppose to use iostream.h in C++. If you dont want to use std:: again and again then this would be a better solutio

Code:
using std::cout;
using std::endl;