C / C++ Code Portfolio



Download 112,15 Kb.
bet8/30
Sana01.03.2022
Hajmi112,15 Kb.
#475852
1   ...   4   5   6   7   8   9   10   11   ...   30
Bog'liq
dddd

int Compare(const void *elemA, const void *elemB)
{
// use strcmp() to determine whether elemA is greater than, less than, or equal to elemB
return(strcmp(*(char **)elemA, *(char **)elemB));
}

void SortStudents(const char *studentList[], size_t studentCount)
{
// use qsort() to sort the student list using Compare()
qsort((void *)studentList, studentCount, sizeof(studentList[0]), Compare);
}

void DisplayClassStatus(const char *registrants[], size_t registrantCount,
const char *attendees[], size_t attendeeCount)
{
printf("Not present:\n");
// for each registrant
for (int registrant = 0; registrant < (int)registrantCount; registrant++)
{
// find whether the registrant attended
char *match = (char *)bsearch(®istrants[registrant], attendees,
attendeeCount, sizeof(attendees[0]), Compare);
// if the registrant didn't attend
if (match == NULL)
{
// print the name of the non-attending registrant
printf("%s\n", registrants[registrant]);
}
}
printf("Not registered:\n");
// for each attendant
for (int attendant = 0; attendant < (int)attendeeCount; attendant++)
{
// find whether the attendant was registered
char *match = (char *)bsearch(&attendees[attendant], registrants,
registrantCount, sizeof(registrants[0]), Compare);
// if the attendant was not registered
if (match == NULL)
{
// print hte name of the non-registered attendant
printf("%s\n", attendees[attendant]);
}
}
}
Bit Operations
// This function finds the number of bits used in an unsigned int type

int CountIntBitsF(void)
{
//set an unsigned int equal to 1, initialize the bit counter

Download 112,15 Kb.

Do'stlaringiz bilan baham:
1   ...   4   5   6   7   8   9   10   11   ...   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