54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
#include "ListE.hpp"
|
|
#include "Tools.hpp"
|
|
#include "Record.hpp"
|
|
#include <iostream>
|
|
#include <iomanip>
|
|
|
|
template <class E> void display(List<E> list) {
|
|
for (int i = 0; i < list.length(); i++) {
|
|
std::cout << list[i] << ' ';
|
|
}
|
|
std::cout << std::endl;
|
|
}
|
|
|
|
int main() {
|
|
List<int> aList;
|
|
aList.append(4);
|
|
aList.append(5);
|
|
aList.append(6);
|
|
aList.append(7);
|
|
display(aList);
|
|
aList.append(8);
|
|
aList.pop(0);
|
|
display(aList);
|
|
|
|
aList.swap(0, 3);
|
|
display(aList);
|
|
|
|
// aList.sort([=](const int &a, const int &b) { return a > b; });
|
|
|
|
// display(aList);
|
|
|
|
List<int> bList =
|
|
aList.sorted([=](const int &a, const int &b) { return a > b; });
|
|
|
|
display(bList);
|
|
|
|
bList.append(5);
|
|
|
|
display(bList);
|
|
|
|
bList.filter([=](const int &a) { return a > 6; });
|
|
display(bList);
|
|
std::cout << "hhh" << setoutputcolor(blue, true) << "aaa" << setoutputcolor(blue, false) << "bbb" << resetOutputColor << std::endl;
|
|
LateRecord la(125534456, "SomeCourse", 10821398, "SomeStu");
|
|
AbsentRecord lb(2874238743, "SomeotherCourse", 10239944, "SomeotherStu");
|
|
la.display();
|
|
std::cout << setbgcolor(lightGray);
|
|
lb.display();
|
|
std::cout << resetOutputColor;
|
|
|
|
la.promptForNewStudentInfo();
|
|
la.display();
|
|
return 0;
|
|
} |