tags:

views:

69

answers:

1
class anurag
{
private:
int rollno;
char name[50];
int marks;
float percen;
void percentage(int num)   
{
 percen=(num/500)*100;

}
public:
void getdata(void)
{
cout<<"\n\nEnter the name of the student:";
gets(name);
cout<<"\n\nEnter the roll no: and the marks:";
cin>>rollno>>marks;
percentage(marks);
}
void display(void)
{
cout<<"\n\nThe name of the student is:";
cout.write(name,50);
cout<<"\n\nThe roll no: of the student is:";
cout<<rollno;
cout<<"\n\n The marks obtained is:"<<marks;
cout<<"\n\nThe percentage is:"<<percen;
}};
   void main()
   {
clrscr();
anurag F;
F.getdata();
F.display();
getch();
   }

why the following code is not giving the desired output?

+7  A: 

Because you have a bug.

shoosh
it means my code is absolutely correct
anurag18294
Welcome stranger, this is the non-mirror universe.
shoosh