This is a simple program and my question is to know why is it compulsory to use using namespace std ? why program is not complied without using this ?
#include <iostream>
using namespace std;
int main(){
int a , b , c , d;
cout << "Enter First Value" <<endl;
cin >> a;
cout << "Enter Second Value" <<endl;
cin >> b;
cout << "Enter 1 to add values" << endl << "Enter 2 to subtract values" <<endl <<"Enter 3 to multiply values" <<endl ;
cin >> c;
if (c == 1){
d = a + b;
cout << "After Adding your answer is " << d << endl;
}
else if (c == 2){
d = a - b;
cout << "After Subtracting your answer is " << d << endl;
}
else if (c == 3){
d = a * b;
cout << "After Multiplication your answer is " << d << endl;
}
else{
cout << "You Enter Invalid operation to perform";
}
system("pause"); //buitin function to stop the comand screen.
return 0;
}