Skip to content

Instantly share code, notes, and snippets.

@adoji92

adoji92/cp.cpp

Created Jan 12, 2019
Embed
What would you like to do?
i = 0;
t3 = 0;
while (i < m) {
j = 0;
t2 = t3;
while (j < n) {
t1 = t3 + j; // Changed
temp = Base(a) + t1;
*(temp) = *(Base(b) + t1) + *(Base(c) + t1);
j += 1;
}
i += 1;
t3 += n;
}
i = 0;
while (i < m) {
j = 0;
while (j < n) {
temp = Base(a) + i * n + j;
*(temp) = *(Base(b) + i * n + j) + *(Base(c) + i * n + j);
j += 1;
}
i += 1;
}
i = 0;
while (i < m) {
j = 0;
while (j < n) {
t1 = i * n + j; // Changed
temp = Base(a) + t1; // Changed
*(temp) = *(Base(b) + t1) + *(Base(c) + t1); // Changed
j += 1;
}
i += 1;
}
i = 0;
while (i < m) {
j = 0;
t2 = i * n; // Changed
while (j < n) {
t1 = t2 + j; // Changed
temp = Base(a) + t1;
*(temp) = *(Base(b) + t1) + *(Base(c) + t1);
j += 1;
}
i += 1;
}
class Point {
public:
int x, y;
void move(int x, int y) { ... }
virtual void draw() { ... }
}
class ColorPoint: public Point {
public:
int color;
void draw() { ... }
void setColor(int c) { ... }
}
Point p = new ColorPoint();
p.move(3, 5); // A
p.draw(); // B
private static int[] data = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
public static void t(int i, int x) {
if (i < 5) data[i] = i * x;
else data[i] = -x;
}
public static void main() {
int x = 100;
t(1, x); // A
t(5, x); // B
int y = getFromUserSomehow();
t(y, x); // C
}
public static void t_1(int x) {
data[1] = x;
}
public static void t_5(int x) {
data[5] = -x;
}
i = 0;
t3 = 0; // Changed
while (i < m) {
j = 0;
t2 = t3; // Changed
while (j < n) {
t1 = t2 + j;
temp = Base(a) + t1;
*(temp) = *(Base(b) + t1) + *(Base(c) + t1);
j += 1;
}
i += 1;
t3 += n; // Changed
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment