|
-
Jan 27th, 2002, 03:00 AM
#1
Thread Starter
Addicted Member
the newbie returneth
#include<iostream.h>
#include<conio.h>
const int MAX=4;
class person
{
char name[10];
public:
void display()
{
cout<<name;
}
void accept()
{
cout<<"ENter Name";
cin>>name;
}
};
void main()
{
person *parr[MAX];
for(int i=0;i<MAX;i++)
{
parr[i]=new person;
parr[i]->accept();
}
for(int j=0;j<MAX;j++)
{
parr[i]->display();
}
getch();
}
1)..#include<Iostream> does not work..it doesnt recognise cin/cout/<</>> etc...I have 2 add the ".h" at the end.
2) getch()..the function I think is supposed 2 b used to halt the program so tt the user can read the screen output before the Window vanishes...it apparently stops the program right before any output is done on screen...
3)..the program here is giving me garbage output..cant figure out y.Probably the error would be painfully obvious the next time I look at the code..but still...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|