Tuesday 1 November 2011

[Pak Youth] Fwd: ||| VuHelp4U ||| cs301 Assignment 1 solution idea

-- Header File Source

#ifndef LINKEDLIST_H
#define LINKEDLIST_H
#include
using name space std;
template span>class T>
class LList

{
Private:
class ListNode
{
friend class LList;
T value;
ListNode *nest;
ListNode(T value1, ListNode *next1=NULL)

{
value=value1;
next=next;
}
};
ListNode *head;
public:
LList()
{
head=NULL;
)
~LList();
void appendNode(T);
void insertNode(T);
void deleteNode();
voide displayList();
void MoveNext();
void ShowCurrent();
};

template
voidLList::appendNode(T val)
{
if(head=NULL)
head=new ListNode(val);
else
{
ListNode *nodePtr;

while (nodePtr->next !=NULL)

nodePtr->next=new ListNode(val);
}
}


template
voidLList::displayList()
{
ListNode *nodePtr;
nodePtr =head;
while (nodePtr)
{
cout nodePtr->value endl;
nodePtr =nodePtr->next;
}
}

template
voidLList::ShowCurrent()
{
ListNode *nodePtr;
nodePtr=head;
countnodePtr->value endl;
}

template
voidLList::MoveNext()
{
ListNode *nodePtr;
nodePtr=head;
while (nodePtr)
{
nodePtr = nodePtr->next;
}
}

template
voidLList::insertNode(T val)
{
ListNode *nodePtr, *previousNodePtr;
if(head==NULL || head->value>=val)
{
head=new ListNode(val, head);
}
else
{
previousNodePtr=head;
nodePtr = head->next;

while (nodePtr !=Null&&nodePtr->value
{
previousNodePtr=NodePtr;
nodePtr = nodePtr->next;

previousNodePtr->nest=new ListNode(val, nodePtr);



template
voidLList::deleteNode()
{
ListNode *nodePtr, *previousNodePtr;
if(!head)
return


nodePtr=head;
head=head->next;
deletenodePtr;
}

template
LList::~LList
()
{
ListNode *nodePtr, *nextNodePtr;
nodePtr=head;
while (nodePtr !=NULL)
{
nextNodePte=nodePtr->nest;
delete nodePtr;
nodePtr=nextNodePtr;
}
}

#endif



Source of Mail Program

#include
#include
#include
#include "LList.h"
int main()
{
int TotalPersons=0,NumberofPasses,
LoopCounter=0,a=0,b=0;
string NameToAppend
count"how many people will play parates of Carribeans : course of black pearl game? ";
cin>>TotalPersons;
count"how many passes will be displayed? ";
cin>>NumberofPasses;
LListlist;
while(LoopCounter <=TotalPersons)

{
count"enter players name: ";
cin>>NameToAppend
list.appendNode(nameToAppend);
LoopCounter +=1;
}
while(a<=TotalPersons-1)
{
for(int c=0;c<=NumberodPasses;c++)
{
list.MoveNext();
}
count"removing :";
list.deleteNode();
list.ShowCurrent();

a+=1;
}
count"\nthe survivor is";
list.displayList();
getch();

---------- Forwarded message ----------
From: adeel kharal <adeelkharal@gmail.com>
Date: Tue, Nov 1, 2011 at 3:00 PM
Subject: ||| VuHelp4U ||| cs301 Assignment 1 solution idea
To: vuhelp_pk@googlegroups.com, vuguyscom@googlegroups.com, vu-tinkoo@googlegroups.com, vustudymania@googlegroups.com


cs301 Assignment 1 solution idea

--
To post to this group, send email to vuhelp_pk@googlegroups.com
To unsubscribe from this group, send email to vuhelp_pk+unsubscribe@googlegroups.com

Group Rules Vuhelp4u
1- Sharing of Video songs links, movies links, dramas links are not allowed in study group. Only Islamic and general information Video links allowed.
2- Phone no. sharing is not allowed in the group.
3- SPAM, Advertisement, and Adult messages are NOT allowed and that member will be behaved strictly.



--
Zindagi mein 2 Logo ka buhat khayal rahkoooo

Ist woh jiss ney tumhari jeet ke Liye buhat kuch hara hoo (Father)

2nd woh jiss ko tum ney har dukh me pukaara hoo (Mother)

Regards, 
Umair Saulat

--
You received this message because you are subscribed to the Google Groups "Pak Youth" group.
To post to this group, send email to pak-youth@googlegroups.com.
To unsubscribe from this group, send email to pak-youth+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pak-youth?hl=en.

No comments:

Post a Comment