














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!















Qualification BTEC Level 5 HND Diploma in Computing Unit number and title PROG102: Procedural Programming Submission date Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Student ID Class Assessor name Student declaration I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that making a false declaration is a form of malpractice. Student’s signature Grading grid P 4 P 5 M3 M4 D
Grade: Assessor Signature: Date: Lecturer Signature: Table of Contents No table of contents entries found.
2.Input The students' IDs and grades are entered in the first array of the program. To keep the round rolling until it meets the requirement, I use the "for" loop.
The grade must be in "float" type in this array because it can be a decimal value. It's there because I wanted it to be simple to use. The "for" loop is used to establish a repeated loop for the user, and "int maxid" is used to provide the maximum grade for the student. As we all know, the maximum grade must be lower than the overall grade, thus the software will only process until all of the requirements have been completed.
II. Operation Implementation
This is what you'll see if you choose 1. You'll need to enter all of the IDs and grades for the number of students you specified previously.
B. TASK 2. TEST PLAN 1.Student’s input test
. Data Type Input Expected Result Actual Result 1 Positive Integer Numbers 1,2,3, ,....
2 Characters and special Symbols a,b,c,.. .. A,B,C,.. .. Invalid O K 3 Decimal numbers 2.5,3. ,5. ,... Invalid O K 4 Negative Integer Numbers No - 1,-2,- 3,- 4,.... Invalid O K There are four different types of data, and three of them have passed the test. If you enter decimal values, the application will print the integer number because it can only understand integers, letters, and symbols. That oversight must be rectified.
4.Student’s name test N o. 1 Data Type Positive Integer Numbers Input 1,2,3,4,... Expected Result OK Actual Result OK Status PASSE D 2 Negative Integer Numbers
Invalid input
3 Characters a,b,c, OK OK PASSED 4 Decimal Numbers 2.3,4.7,12.3, ... Invalid input
5 Duplicated numbers 1,2,3,4,.... Invalid input
C. Task 3 EVALUATE THE PROGRAM
#include <stdio.h> #include <stdlib.h> #include <conio.h> #include <string.h> struct student{ char name[50], MSV[50]; float grade; } std[30]; int n; void student(int MSV[], float grade[], char name[50], int n) { int i; for (i = 0; i < n; i++) { printf("Enter a number of student \n\n"); printf("MSV:\n"); fflush(stdin); scanf("%d", &MSV[i]); printf("name: \n"); fflush(stdin); scanf(" %s", &std[i].name); printf("grade:\n"); fflush(stdin); scanf("%f", &grade[i]); } } void max(int MSV[0], float grade[], int n)
int i; int posmin =0; double mingrade = grade[0]; for (i = 0; i < n; i++) { if (mingrade > grade[i]) { mingrade = grade[i]; posmin = i; } } printf("MSV: %d mingrade %.2f\n\n", MSV[posmin], mingrade); system("pause"); } int main() { int MSV[n]; float grade[n]; char name[n]; int choice; do { system("cls"); printf(" -Menu- \n"); printf("/=================/\n"); printf(" 1. Input MSV and grade of student\n "); printf(" 2. Display Student information\n"); printf(" 3. Display Max Grade of student \n");
printf(" 4. Display Min Grade of student \n"); printf(" 5. Exit \n"); printf("/=================/\n"); printf(" -End- \n"); fflush(stdin); printf("\n Enter the choice: "); scanf("%d", &choice); switch (choice) { case 1: printf("How many students do you want to add to the list?: \n"); scanf("%d", &n); student(MSV, grade, name, n); system("pause"); system("cls"); break; case 2: display(MSV, grade, name, n); system("pause"); system("cls"); break; case 3: max(MSV, grade, n); system("pause"); system("cls"); break; case 4: min(MSV, grade, n);