I download dev-c++ and write simple programe.
but after compiling that prog i'm facinf problems with errors with iostrea.h and undefined sysmbol cout, cin.
so what could be the possible causes of the error???
#include<iostream>
class Name
{
public:
char name[26];
void Print()
{
cout<<"Enter Your Name :"/n;
cin>>name;
}
void display()
{
cout<<"Your Name Is :"name;
}
};
int main()
{
Name N1;
N1.Print;
N1.display;
return 0;
}
that's how i wrot the programme after compiling error : Unable to open iostream, and undefined sysmbot cout and cin.
The original code mehulpachchigar posted compiles for me after adding "using namespace std" and fixing common syntax problems like missing parentheses and semicolons.
Yeah. But since the 2 functions (Print() and display()) are very short, it won't hurt to make them into one function. And strings might be better for holding a name, unless you plan on operating on each separate character.
thanks, the problem get solved by adding std:: before cout and cin with dev-c++.
but i still have problem with the same project in borland Turbo C++ V. 3.0.
Well because you used return(0), the program will terminate when it reaches there, without a pause (on most IDE's).
Good thing for you, is that there's a WHOLE thread on that topic. It's sticked so you can read it. It's full of plentiful responses, so take some time and read the replies.