Moc Exam
Moc Exam
Mock Examination
Problem 1: Write a program to input a square 2D-matrix with m rows and m columns. Then output the
transposition matrix to the screen.
Input: Output:
1 2 3 1 2 9
2 5 5 2 5 4
9 4 2 3 5 2
Input: Output:
Input:
Output :
Problem 4: Create a list of employees, each employee is considered as a structure including the fields
Fullname, Age, and Salary. Enter some employees in the list, sort the list by their age, print the sorted
list to the screen.
struct employee{
string fullname;
int age;
double salary;
};
Input: Please in put n: 3
Age: 21
Salary: 26400
Lecturer: Quang-Thai Ho
YUAN ZE UNIVERSITY – Fundamental Computer Programming- C++ Lab(I)
Output:
Problem 5: Write a problem to read a number list from a file unordered_list.dat. Then, sort the list in
ácending order and write the sorted list back to another file named ordered_list.dat
165279483
123456789
Lecturer: Quang-Thai Ho