Professional Documents
Culture Documents
Faculty of Engineering: Receipt of Lab Report Submission (To Be Kept by Student)
Faculty of Engineering: Receipt of Lab Report Submission (To Be Kept by Student)
Faculty of Engineering: Receipt of Lab Report Submission (To Be Kept by Student)
FACULTY OF ENGINEERING
Student ID No : 1001852494
Student ID No : 1001852494
Received by:-
Semester : September 2020
Student ID No:1001852494
Total
4
Sample input/code
/*
// mohamed Hussein jama 1001852494
Algorithm:
//step1: declaring the member names or member declaration
//step2: declaring variables to store member names.
//step3: declaring an input and output file to store in and output from there and at the
same time checking the errors.
//step4: applying arrays function to store student names and tests.
//step5: using for loop to read all the data from the input file.
//step6: displaying the numbers in 2 decimals places.
//step7: displaying the student names, tests and the total.
//step8: using for loop to display and output student names and their test marks.
//step9: add all together in order to find the average marks.
//step10: displaying the results in black screen and the output file.
//step11: using for loop and if statement to find the lowest and highest mark.
//step12: displaying the highest and lowest marks.
*/
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cstdlib>
const int NUMERCES = 6; //maximum numbers of the students struct student_marks //global
declaration
//step1
struct student_marks {
};
5
int main()
//step2
//step3
//step4
student_marks output[NUMERCES];
//step5
hargaisa>>output[i].name>>output[i].test1>>output[i].test2>>output[i].test3;
//step7
cout<<setiosflags(ios::left)<<setw(15)<<"student name"<<setw(7)<<"test1"<<setw(7)
<<"test2"<<setw(7)<<"test3"<<setw(7)<<"total"<<endl;
malaysia<<setiosflags(ios::left)<<setw(15)<<"student name"<<setw(7)<<"test1"<<setw(7)
<<"test2"<<setw(7)<<"test3"<<setw(7)<<"total"<<endl;
6
//step8
output[i].total=output[i].test1+output[i].test2+output[i].test3;
cout<<setiosflags(ios::left)<<setw(15)<<output[i].name<<setw(7)<<output[i].test1<<setw(7)<<output
[i].test2
<<setw(7)<<output[i].test3<<setw(7)<<output[i].total<<endl;
malaysia<<setiosflags(ios::left)<<setw(15)<<output[i].name<<setw(7)<<output[i].test1<<setw(7)<<outp
ut[i].test2
<<setw(7)<<output[i].test3<<setw(7)<<output[i].total<<endl;
//step9 avg_test1 =
avg_test1 =
(output[0].test1+output[1].test1+output[2].test1+output[3].test1+output[4].test1+output[5].test1)/6;
avg_test2 =
(output[0].test2+output[1].test2+output[2].test2+output[3].test2+output[4].test2+output[5].test1)/6;
avg_test3 =
(output[0].test3+output[1].test3+output[2].test3+output[3].test3+output[4].test3+output[5].test1)/6;
//step10 cout<<"\n"<<endl;
cout<<setiosflags(ios::left)<<setw(7)<<"average"<<setw(7)<<avg_test1<<setw(7)<<avg_test2<<setw(7)<
<avg_test3<<endl;
malaysia<<setiosflags(ios::left)<<setw(7)<<"average"<<setw(7)<<avg_test1<<setw(7)<<avg_test2<<setw
(7)<<avg_test3<<endl;
//step11
//step12
net_total =
(output[0].total+output[1].total+output[2].total+output[3].total+output[4].total+output[5].total)/6;
cout<<"the average total marks of the students are "<<net_total<<endl;
hargaisa.close();
malaysia.close();
return 0;
}
8
Sample outputs
9
10