OOP HomeWork

This commit is contained in:
e2hang
2025-08-11 00:01:30 +08:00
commit e8a5ca2363
119 changed files with 3187 additions and 0 deletions

87
oop_hw4/hw8/page.cpp Normal file
View File

@@ -0,0 +1,87 @@
#include <iostream>
#include "page.h"
using std::cin;
using std::cout;
using std::endl;
void out(int n) {
switch (n)
{
case 1:
cout << "<EFBFBD><EFBFBD>ҳ 1+ 2 3 4 5 <20><> 13 <20><>ҳ" << endl;
break;
case 2:
cout << "<EFBFBD><EFBFBD>ҳ 1 2+ 3 4 5 <20><> 13 <20><>ҳ" << endl;
break;
case 3:
cout << "<EFBFBD><EFBFBD>ҳ 1 2 3+ 4 5 <20><> 13 <20><>ҳ" << endl;
break;
case 4:
cout << "<EFBFBD><EFBFBD>ҳ 1 2 3 4+ 5 <20><> 13 <20><>ҳ" << endl;
break;
case 5:
cout << "<EFBFBD><EFBFBD>ҳ 1 2 3 4 5+ <20><> 13 <20><>ҳ" << endl;
break;
case 6:
cout << "<EFBFBD><EFBFBD>ҳ 1 <20><> 6+ 7 8 9 10 <20><> 13 <20><>ҳ" << endl;
break;
case 7:
cout << "<EFBFBD><EFBFBD>ҳ 1 <20><> 6 7+ 8 9 10 <20><> 13 <20><>ҳ" << endl;
break;
case 8:
cout << "<EFBFBD><EFBFBD>ҳ 1 <20><> 6 7 8+ 9 10 <20><> 13 <20><>ҳ" << endl;
break;
case 9:
cout << "<EFBFBD><EFBFBD>ҳ 1 <20><> 6 7 8 9+ 10 <20><> 13 <20><>ҳ" << endl;
break;
case 10:
cout << "<EFBFBD><EFBFBD>ҳ 1 <20><> 6 7 8 9 10+ <20><> 13 <20><>ҳ" << endl;
break;
case 11:
cout << "<EFBFBD><EFBFBD>ҳ 1 <20><> 9 10 11+ 12 13 <20><>ҳ" << endl;
break;
case 12:
cout << "<EFBFBD><EFBFBD>ҳ 1 <20><> 9 10 11 12+ 13 <20><>ҳ" << endl;
break;
case 13:
cout << "<EFBFBD><EFBFBD>ҳ 1 <20><> 9 10 11 12 13+ <20><>ҳ" << endl;
break;
default:
cout << "Fail!" << endl;
break;
}
}
Paginate::Paginate() {
page_now = 0;
page_total = 0;
}
Paginate::Paginate(int n) {
page_total = n;
}
Paginate& Paginate::setPage(int n) {
page_now = n;
return *this;
}
Paginate& Paginate::next() {
page_now += 1;
return *this;
}
Paginate& Paginate::prev() {
page_now -= 1;
return *this;
}
Paginate& Paginate::nextN() {
page_now += 5;
return *this;
}
Paginate& Paginate::prevN() {
page_now -= 5;
return *this;
}
void Paginate::show() {
out(this->page_now);
}