I copied this code from page 11 of
http://personal.denison.edu/~krone/cs173/files/PythontoC++.pdf
and assigned it to a Python string.
Alas there are still line numbers. How could I use Python to remove these? Help, I have a mental block.
s = '''
1 #include <iostream>
2 using namespace std;
3
4 int gcd(int u, int v) {
5 int r;
6 while (v != 0) {
7 r = u % v; // compute remainder
8 u = v;
9 v = r;
10 }
11 return u;
12 }
13
14 int main( ) {
15 int a, b;
16 cout << "Enter first number: ";
17 cin >> a;
18 cout << "Enter second number: ";
19 cin >> b;
20 cout << "The gcd is " << gcd(a,b) << endl;
21 return 0;
22 }
'''