Go: package main

import (
        "fmt"
        "math"
)

func main() {
        var r, d float64
        var x, y, rad float64
        rad = math.Pi / 2
        for {
                _, err := fmt.Scanf("%f,%f", &d, &r)
                if err != nil {
                        break
                }
                if r == 0.0 && d == 0.0 {
                        break
                }

                x += d * math.Cos(rad)
                y += d * math.Sin(rad)
                rad -= r * math.Pi / 180
        }

        fmt.Printf("%d\n", int(x))
        fmt.Printf("%d\n", int(y))
}

C++: #include <iostream>
#include <cmath>
#include <string>
using namespace std;

int main(){
	string str;
	double x, y;
	int step, carb, arg;
	int p;
	bool minus;
	
	x = 0; y = 0; arg = 90;
	while(true){
		cin >> str;
		step = 0; carb = 0;
		p = 0;
		while(str[p] != ','){
			step = step * 10 + (str[p] - 48);
			p++;
		}
		p++;
		minus = false;
		while(p < str.size()){
			if(str[p] == '-') minus = true;
			else carb = carb * 10 + (str[p] - 48);
			p++;
		}
		if(step == 0 && carb == 0) break;
		if(!minus) carb *= -1;
		
		cout << step << " " << carb << endl;
		
		x += (double)step * cos((double)arg * 3.1415 / 180.0);
		y += (double)step * sin((double)arg * 3.1415 / 180.0);
		
		arg += carb;
	}
	
	cout << (int)x << endl << (int)y << endl;
	
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
using namespace std;

int main(){
	int x, r;
	char split;
	double cx = 0.0;
	double cy = 0.0;
	int cr = 0;
	while (cin >> x >> split >> r) {
		if (x == 0 && r == 0) break;
		cx += x * sin(cr * M_PI / 180);
		cy += x * cos(cr * M_PI / 180);
		cr += r;
	}
	cout << fixed << setprecision(0) << cx << endl;
	cout << fixed << setprecision(0) << cy << endl;

	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;

int main() {
    double x = 0;
    double y = 0;
    double const pi = acos(-1.0);
    int16_t theta = 90;
    int d, t;
    char c;

    for(cin >> d >> c >> t; d != 1 || t != 0; cin >> d >> c >> t) {
        x += d * cos(pi * theta / 180);
        y += d * sin(pi * theta / 180);
        theta -= t;
        if(theta < 0) {
            theta += 360;
        } else {
            theta %= 360;
        }
    }
    cout << static_cast<int32_t>(x) << endl;
    cout << static_cast<int32_t>(y) << endl;
    return 0;
}

C++: #include <iostream>
#include <cmath>
#define PI 3.14159265;
#define RAD (PI/180)

using namespace std;

int main() {
	
	int m, angle;
	double x=0, y=0, deg=90;

	while(1) {
		cin >> m >> angle;
		if(m==0&&angle==0)
			break;
		x+=(double)m*cos(deg*RAD);
		y+=(double)m*sin(deg*RAD);
		deg-=angle;
	}

	cout << (int)x << endl << (int)y << endl;

	return 0;

}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	const double EPS=1e-10;
	double x=0,y=0;
	double dir=M_PI/2;
	for(int a,d;scanf("%d,%d",&a,&d),a|d;){
		x+=a*cos(dir);
		y+=a*sin(dir);
		dir-=d*M_PI/180;
	}
	printf("%d\n%d\n",int(x+EPS),int(y+EPS));
	
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>


int main()
{
double N,P=0;
double x,y;
double p=0,P1=0;
x=0;y=0;
while(1)
{
scanf("%lf,%lf",&N,&P1);
if((int)N==0&&(int)P1==0)break;

if(0<=(int)P&&(int)P<90){p=P*M_PI/180;x+=N*sin(p);y+=N*cos(p);}
else if(90<=(int)P&&(int)P<=180){p=(180-P)*M_PI/180;x+=N*sin(p);y-=N*cos(p);}
else if(0>(int)P&&(int)P>=-90){p=(-1*P)*M_PI/180;x-=N*sin(p);y+=N*cos(p);}
else if(-90>(int)P&&(int)P>=-180){p=(180+P)*M_PI/180;x-=N*sin(p);y-=N*cos(p);}
P=P1;
}
int X,Y;
X=(int)x;Y=(int)y;
printf("%d\n",X);printf("%d\n",Y);

return 0;
}

C++: #include <iostream>
#include <cmath>

using namespace std;

double degToRad(int deg) {
  return deg * M_PI / 180;
}

int main(void) {
  double x = 0.0, y = 0.0;
  int deg = 90;

  while(1) {
    int l, d;
    scanf("%d,%d", &l, &d);
    if(l == 0 && d == 0) break;

    x += l*cos(degToRad(deg));
    y += l*sin(degToRad(deg));

    deg -= d;
  }

  cout << (int)x << endl;
  cout << (int)y << endl;

  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T> int GetInt(T a){ return a >= 0 ? floor(a) : ceil(a); }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }
const double PI = 3.141592653583;
#define DegreeToRadian(Degree) ((float)Degree * (PI / 180.0f))

vector<string> split(string str, string delim)
{
    vector<string> result;
    int cutAt;
    while( (cutAt = str.find_first_of(delim)) != str.npos )
    {
        if(cutAt > 0)
        {
            result.push_back(str.substr(0, cutAt));
        }
        str = str.substr(cutAt + 1);
    }
    if(str.length() > 0)
    {
        result.push_back(str);
    }
return result;
}

int main()
{
	ifstream ifs("data.txt");
	int x, r, R = 0;
	pair<double, double> point = mp(0, 0);
	string str;
	
	while(ifs >> str)
	{
		vector<string> l = split(str, ",");

		x = r = 0;
		rep(i, l[0].size())
		{
			if(l[0][i] != '-')
				x += (l[0][i] - '0') * pow(10, (float)l[0].size() - i -1);
		}
		rep(i, l[1].size())
		{
			if(l[1][i] != '-')
				r += (l[1][i] - '0') * pow(10, (float)l[1].size() - i -1);
		}
		if(l[0][0] == '-')
			x *= -1;
		if(l[1][0] == '-')
			r *= -1;

		if(!(x || r))
			break;

		R = min(R, 360);

		point.first += sin(DegreeToRadian(R)) * x;
		point.second += cos(DegreeToRadian(R)) * x;

		R += r;
	}

	pint res = mp(GetInt(point.first), GetInt(point.second));
	printf("%d\n%d\n", res.first, res.second);
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
  double x = 0, y = 0;
  int angle = 90;

  while(true){
    int d, a; 
    scanf("%d,%d", &d, &a);
    if(d == 0 && a == 0) break;

    x += d * cos(angle*acos(-1)/180.0);
    y += d * sin(angle*acos(-1)/180.0);
    angle -= a;
  }

  cout << (int)x << endl;
  cout << (int)y << endl;
}