The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.

Note and Tutorial C Programming BI v3

Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by sekolah-142, 2021-04-09 07:59:47

Module C Programming BI v3

Note and Tutorial C Programming BI v3

Keywords: Module C Programming

2nd Semester: Programming (C Language) – 3rd Edition 2021

return temp;
}

void list(book sp[ ],int size)
{

int i;

putchar('\n');

puts("<<BookList>>");

for (i=0;i<size;++i)

{
printf("%d:%s by %s--%s\n",i+1,sp[i].title, sp[i].author,sp[i].category);

}

//while(cin.get()!='q');
return;

}

6. //Penggunaan struct bertatasusunan(array)

#include<stdio.h>
#include<string.h>

#define BIL 1

// penakrifan struct bersama pengumpukan nilai awalan
struct pekerja
{

char nama[30];
int no_pek;
char gred_gaji[5];
float gaji;
char jawatan[30];
}emp[BIL];

void main( )
{

// input papan kekunci
printf("\nSISTEM REKOD PEKERJA SYARIKAT XYZ\n");

for (int i=0; i<BIL; i++)
{

printf("\nMasukkan rekod pekerja %d\n", i+1);

© Nar | Nisrin Ahmad Ramly \(^o^)/

2nd Semester: Programming (C Language) – 3rd Edition 2021

printf("Nama pekerja\t:");
scanf("%s",emp[i].nama);

printf("Gred gaji\t:");
scanf("%s",emp[i].gred_gaji);

printf("Jawatan\t\t:");
scanf("%s",emp[i].jawatan);

printf("No. Pekerja\t:");
scanf("%d", &emp[i].no_pek);

printf("Gaji\t\t:RM");
scanf("%f",&emp[i].gaji);
}

// mencetak maklumat rekod
printf("\n\n****Kandungan Rekod Syarikat XYZ****\n");

for(i=0; i<BIL; i++)
{

printf("\nRekod pekerja %d\n", i+1);
printf("\nNama\t\t:%s\n", emp[i].nama);
printf("No. Pekerja\t:%d\n", emp[i].no_pek);
printf("Gred Gaji\t:%s\n", emp[i].gred_gaji);
printf("Gaji\t\t:RM%.2f\n", emp[i].gaji);
printf("Jawatan\t\t:%s\n", emp[i].jawatan);
}
}

7. /* latihan-modify aturcara di atas.
1. Tanya berapa rekod mahu dimasukkan
2. Buat kawalan ke atas input
3. Tanya nak papar rekod atau tidak. */

© Nar | Nisrin Ahmad Ramly \(^o^)/

2nd Semester: Programming (C Language) – 3rd Edition 2021
7. References

1. C_How_to_Program_7th_Edition_by_Paul_Dei.pdf
2. https://www.tutorialspoint.com/cprogramming/
3. https://www.w3schools.in/c-tutorial/
4. http://study.com/academy/lesson/pseudocode-definition-examples-quiz.html
5. http://www.programiz.com/article/flowchart-programming
6. http://newb6.u-strasbg.fr/~siebert/pages/teaching/INFO-L2/Exercise_C_L2STUE.pdf
7. http://programmingclangauge.weebly.com/control-structure.html
8. http://www.di.uniba.it/~lanubile/fisica/ch05.pdf
9. http://fresh2refresh.com/c-programming/c-decision-control/
10. https://www.programtopia.net/c-programming/docs/nested-loop
11. http://www.programmingsimplified.com/c-program-print-stars-pyramid
12. http://www.studytonight.com/c/user-defined-functions-in-c.php
13. https://www.programiz.com/c-programming/c-arrays
14. http://fresh2refresh.com/c-programming/c-array/
15. http://www.brucemerry.org.za/manual/algorithms/sorting.html
16. https://www.w3schools.in/c-tutorial/

© Nar | Nisrin Ahmad Ramly \(^o^)/


Click to View FlipBook Version