#include<iostream> // iostream, not iostream.h
//#include<conio.h>
usingnamespace std; // ahem - not everyone's gonna like this
class numbers
{
private:
int a,b;
public:
void readnumbers();
void add();
};
void numbers::readnumbers()
{
cout<<"Enter the value of a: ";
cin>>a;
cout<<"Enter the value of b: ";
cin>>b;
}
void numbers::add()
{
int c=a+b;
cout<<"Addition: "<<c;
}
int main() // int main, not void main
{
// clrscr();
numbers num;
num.readnumbers();
num.add();
// getch();
}
Enter the value of a: 1
Enter the value of b: 2
Addition: 3
WHEN I REPLACE <iostream>
AND REPLACED using namespace std; INSTEAD <conio.h> then following errors are coming
1)UNABLE TO OPEN INCLUDE FILE 'IOSTREAM' THIS ERROR IS COMING
2)DECLARATION SYNTAX ERROR
3)UNDEFINED SYMBOL 'COUT
4)UNDEFINED SYMBOL 'CIN
@p01ajanikar I'm guessing you are using Turbo C++ 3,0, is that the case?
I understand that some education courses still use it - but bear in mind that it is well over 20 years old and bears no resemblance to modern standardised C++.