Professional Documents
Culture Documents
Usmi
Usmi
#include <string.h>
struct StudentProfile{
string userid;
string userName;
string subject;
string degreeName;
string uniName;
};
class ArrayList{
private:
StudentProfile * arr;
int current;
int listSize;
public:
ArrayList();
int listLenght();
void showList();
~ArrayList();
};
ArrayList::ArrayList(){
listSize = 0 ;
current = 0;
arr[listSize] = x ;
listSize++;
current = listSize;
return arr[x];
arr[position] = student;
arr[x].userid = "";
arr[x].userName="";
arr[x].subject="";
arr[x].degreeName="";
arr[x].uniName="";
int ArrayList::listLenght(){
return listSize;
void ArrayList::showList(){
int SrNo = 1 ;
if(arr[i].userid != ""){
cout <<SrNo <<" "<< arr[i].userid<< " " <<arr[i].userName <<" " <<arr[i].subject <<" "
<<arr[i].degreeName<< " "<< arr[i].uniName<< endl;
SrNo++;
ArrayList::~ArrayList(){
delete []arr;
int main(){
ArrayList StudentArray;
std1.userid = "MC180400224" ;
std1.userName = "Ali" ;
std1.subject = "CS301" ;
std1.degreeName = "MCS";
std1.uniName = "VU";
// Student 2
std2.userid = "MC1807678890" ;
std2.userName = "Naeem" ;
std2.subject = "CS301" ;
std2.degreeName = "MCS";
std2.uniName = "VU";
// Student 3
std3.userid = "MC180401444" ;
std3.userName = "khuram" ;
std3.subject = "CS301" ;
std3.degreeName = "MCS";
std3.uniName = "VU";
// Student 4
std4.userid = "MC180607997" ;
std4.userName = "haris" ;
std4.subject = "CS301" ;
std4.degreeName= "MCS";
std4.uniName = "VU";
// Student 5
std5.userid = "MC180477788" ;
std5.userName = "awais" ;
std5.subject = "CS301" ;
std5.degreeName= "MCS";
std5.uniName = "VU";
StudentArray.add(std1);
StudentArray.add(std2);
StudentArray.add(std3);
StudentArray.add(std4);
StudentArray.add(std5);
StudentArray.showList();
cout <<"Student Found At position 4 is having the ID: " <<found.userid<< endl ;
std4.userName = "haris" ;
std4.subject = "CS301" ;
std4.degreeName = "MCS";
std4.uniName = "VU";
StudentArray.update(3, std4);
StudentArray.showList();
StudentArray.remove(3);