CS301P Lab 1 Solution
CS301P Lab 1 Solution
#include<iostream>
#include<conio.h>
using namespace std;
class Faculty
{
private:
string name, post;
int age;
public:
void setName(string n)
{
name = n;
}
void setPost(string p)
{
post = p;
}
void setAge(int a)
{
age = a;
}
string getName()
{
return name;
}
string getPost()
{
return post;
}
int getAge()
{
return age;
}
};
class Node
{
private:
Faculty object;
Node *nextAdd;
public:
void set(Faculty obj)
{
object = obj;
}
Node* getNext()
{
return nextAdd;
}
};
class List
{
private:
Node *Head;
Node *Tail;
public:
List()
{
Head = NULL;
Tail = NULL;
}
if(Head == NULL)
{
Head = newNode;
Tail = newNode;
}
else
{
Tail -> setNext(newNode);
Tail = newNode;
}
}
void traverse()
{
Node *ptr = Head;
Faculty obj;
F.setName(name);
F.setAge(age);
F.setPost(post);
L.add(F);
cout << "\n\n----------------------------\n\n";
}