-
Notifications
You must be signed in to change notification settings - Fork 0
/
mwe.cpp
32 lines (24 loc) · 952 Bytes
/
mwe.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "bruteforcefrac.h"
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <cinttypes>
int main() {
printf("What do you want to factor? >>> ");
uint64_t factorme = 0;
scanf("%" PRIu64, &factorme);
// "IntFactorVector.h"
std::vector<bffrac::IntFactor*>* primeFactors = bffrac::primeFactorizeToVector(factorme);
bffrac::printFacVec(primeFactors);
delete primeFactors;
// "RationalNum.h"
int64_t numer = 0; int64_t denom = 0;
printf("\nEnter a fraction in the form a/b >>> ");
if (scanf("%" PRIi64 "/%" PRIi64, &numer, &denom) == 2) {
bffrac::RationalNum testFrac = bffrac::RationalNum(numer,denom);
printf("testFrac: %" PRIu64 "/%" PRIu64 "\n", testFrac.getNumerator(), testFrac.getDenominator() );
testFrac.simplify();
printf("simplified testFrac: %" PRIu64 "/%" PRIu64 "\n", testFrac.getNumerator(),
testFrac.getDenominator() );
}
}