Write a program in Cno import of Javax or anything similar t

Write a program in C++(no import of Javax or anything similar) that does the following:

There is a class human and a derived class student.
The enum in this case is gender(male, female)

Read in a text file of unknown line number that is formatted:
name;id;enum.
name1;id1;enum1;

Dynamically allocate student objects and store the objects in the array humanList (an array of human pointers). Include a pointer as well.

Solution

# include<fstream>
#include<iostream>
using namespace std;
class Human
{
public:
string name;
int id;
enum gender
{
male,
female
};

};

class student : public Human
{
};


int main()
{

student s1 ;

Human* h1 = &s1;

ifstream infile;
string str;

infile.open(\"afile.dat\");

while(getline(infile,str))
{
sscanf(str,\"%s%d%d\",s1.name,s1.id,s1.gender[0]);

}

return 0;
}

Write a program in C++(no import of Javax or anything similar) that does the following: There is a class human and a derived class student. The enum in this cas

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site