Quote:Describe this algorithm in C++

You code is specially crafted to be unreadable.

Saving key stokes is a bad idea, it makes only code more difficult to read and understand.

Try a Best C Formatter and Beautifier[^]

Advice: Learn to indent properly your code, it show its structure and it helps reading and understanding. It also helps spotting structures mistakes.

C++

a0 = a; b0 = b; x1 = 1; x2 = 0; do { if (a > b) { q = a / b; a %= b; t = x2; x2 = x1 - q * x2; x1 = t; if (a < 1) { gcd = b; x = x1; y = (b - x * a0) / b0; break; } else { b -= a; t = x2; x2 = x1 - x2; x1 = t; if (a == b) { gcd = a; x = x1; y = (b - x * a0) / b0; break; } } } else { q = b / a; b %= a; t = x1; x1 = x2 - q * x1; x2 = t; if (b < 1) { gcd = a; x = x2; y = (a - x * a0) / b0; break; } else { a -= b; t = x1; x1 = x2 - x1; x2 = t; if (a == b) { gcd = b; x = x2; y = (a - x * a0) / b0; break; } } } } while (true);

Indentation style - Wikipedia[^]

Professional programmer's editors have this feature and others ones such as parenthesis matching and syntax highlighting.

Notepad++ Home[^]

ultraedit[^]

Enabling Open Innovation & Collaboration | The Eclipse Foundation[^]

This assignment is a test of what YOU know, not what other people know.