My goal is to have a function that receives an int (0-100) and uses that amount of cpu usage on a thread. So if it was given 17, the cpu usage would be 17%. 54, 54%.
I've tried writing functions that add/multiply varying amounts of numbers depending on the input but they always ended up using similar amounts of cpu usage.
This is the basic idea I had but I would continue the varying amounts of multiplications based on the input.
#include <cstdlib>
#include <iostream>
using namespace std;
int main() {
int cpu_use;
cin >> cpu_use;
int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y,
z, aa, ba, ca, da, ea, fa, ga, ha, ia, ja, ka, la, ma, na, oa, pa, qa, ra,
sa, ta, ua, va, wa, xa, ya, za, ab, bb, cb, db, eb, fb, gb, hb, ib, jb,
kb, lb, mb, nb, ob, pb, qb, rb, sb, tb, ub, vb, wb, xb, yb, zb, ac, bc,
cc, dc, ec, fc, gc, hc, ic, jc, kc, lc, mc, nc, oc, pc, qc, rc, sc, tc,
uc, vc;
switch (cpu_use) {
case 1:
a + a;
break;
case 2:
a *a *b *b;
break;
case 3:
a *a *b *b *c *c;
break;
case 4:
a *a *b *b *c *c *d *d;
break;
}
} while (1);
return 0;
}