Rewrite the following program after removing the syntactical error(s) if any. Underline each correction.

#include<iostream.h>
#include<conio.h>
class employee
{   int no;
    class data
    {   int dd,mm,yy;
	public:
	void print_data()
	{  cout<<dd<<mm<<yy;  }
    };
    data dob;
    public:
    data doj;
    void prin_t()
    {     doj.print_data();
	   cout<<dob.dd<<dob.mm<<dob.yy;   }
};
void main()
{    employee 1emp;
     data 2emp;  }

I am studying in +2.
I think the errors are in main function, 1emp is wrong and cannot call data as it is a private function. are there any more corrections?

Yes, there are more corrections. How many more depends on the compiler you're using, because this code makes assumptions about the language that aren't supported by modern compilers.

But if you ignore those problems, there are four corrections required to make the code compilable. You have options in what corrections to apply, there may be multiple instances of the same error type, and one correction may fix multiple errors, but there are still four distinct errors that need to be fixed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.