C / C++ Code Portfolio


break; } } // if no matching string was found if



Download 112,15 Kb.
bet27/30
Sana01.03.2022
Hajmi112,15 Kb.
#475852
1   ...   22   23   24   25   26   27   28   29   30
Bog'liq
dddd

break;
}
}
// if no matching string was found
if (!stringFound)
{
// create a new node, and store the new string in the node
currentNode = CreateListNode(nextString);
// place the new node at the beginning of the linked list
Insert(&firstNode, currentNode);
}
}
// return the first node of the linked list
return firstNode;
}

List *PrintList(const List *head)


{
List *nextNode = head;
// for every node...
for (; nextNode != NULL; nextNode = nextNode->next)
//print the string and count of the node
printf("%-20s %3d ea\n", nextNode->str, nextNode->count);
return((List *)head);
}

void FreeList(List *head)
{
// for every node...
while (head != NULL)
{
// temporarily create a new node that is equal to the node at the start of the linked list
List *nodePointer = head;
// prepare to advance to the next node
head = head->next;
// free the string stored in the node
free(head->str);
// free the node
free(nodePointer);
}
}
Example: Queue
// This program demonstrates a Queue container

#include


using std::cout;
using std::copy;

#include


using std::logic_error;

#include



const int numElems = 10;
const int elems[numElems] = { 0,1,2,3,4,5,6,7,8,9 };
const int initialSize = 3;

template <typename T>
class Queue
{
public:
Queue(); // Construct empty queue
~Queue(); // Destructor
Queue(const Queue &); // Copy constructor
Queue &operator=(const Queue &); // Copy assignment operator
void push(const T &); // Add element to back of queue

Download 112,15 Kb.

Do'stlaringiz bilan baham:
1   ...   22   23   24   25   26   27   28   29   30




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish