
It looks like crap, but have fun.
Code: Select all
#include <iostream>
#include <vector>
#include <stdint.h>
class Prime {
std::vector<uint32_t> P_list;
uint32_t test;
uint32_t Get(uint32_t n) {
while(n >= P_list.size()) {
test += 2;
for (uint32_t i = 1; test >= P_list[i] * P_list[i]; i++) {
if(test % P_list[i] == 0) {
test += 2;
i = 0;
}
}
P_list.push_back(test);
}
return P_list[n];
}
public:
Prime() : test(3) {
P_list.push_back(2);
P_list.push_back(3);
int32_t n;
while(true) {
std::cout << "type in a number greater than 0 to get the corosponding prime or type 0 to exit: ";
std::cin >> n;
if(!n) break;
std::cout << "the " << n;
if(n % 10 == 1) std::cout << "st";
else if(n % 10 == 2) std::cout << "nd";
else if(n % 10 == 3) std::cout << "rd";
else std::cout << "th";
std::cout << " prime number is: " << Get(n-1) << std::endl;
}
}
};
Code: Select all
#i#ilulu < <didih>h>ininudud<s<slilih>h>ininudud<s<s/t/teses>
>
clcle e ysystatah>h>ininudud<f<ftltl>
>
clcle e ninid.d.
t
tdedeunungngn s srtrtOROR
crcrtwtwd(d(RDRD)/)/ncncptpta a RDRDndndetetnsnshehencncptpt w wd
d
= =WOWO)")"TTTT
r
rrnrn;
;
vovo d dwowo(W(WD D
{
{= = /2/2}
}
t t ininntntrgrgchch * *gvgv)
)
ririf(f(ekekfifi m mglglg g ogogm\m\););ntntococptpt o on(n(gvgv],],RDRD););ntntrrrrs;s;ntntiziz = =;
;
ucucstst c catatWOWO n nypyp
v
v * *f f &n&nypyp
v
v * *ufuf & &tata
i
iococptpt)
)
ririf(f(RRRR: : S SH H LELEN N ISISIRIRTOTO\n\n;
;
urur0;0;
(a(av[v[,s,sf)f)prprtftfTHTHSISI O OTHTHFIFI I I%d%dYTYT\n\ncscst.t._s_se)e)sisiw w cscst.t._s_se e 2;2;inini i 1;1;hihi(i(i=(=(tataststiziz2)2){
{
d(d(crcrt,t,f,f,zeze(W(WD)D)
c
ctwtwd(d(ryry););riri(t(tryry,b,b,s,seoeoWOWO))))i+i+
}
}ririf(f(ONONn"n"
r
rrnrn;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
I'm suppose to be writing finishing my C++ network chat program (which is nearly done) - you control 3D avatars and the speech bubble above your head fills as you type.Zacariaz wrote:you think you know about boredom?
I once wrote a ink lbop test. Unfortunantly i have drown away the source, but i still have the windows binary.