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<vector>
#include<cstdio>
using namespace std;

#define X 0
#define Y 1
#define PI 3.141592653589

int main()
{
    vector<double> udv = {0,1}; // 単位方向ベクトル
    vector<double> cur_position = {0, 0};

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

        cur_position.at(X) += udv.at(X)*step;
        cur_position.at(Y) += udv.at(Y)*step;

        // rotation
        double x =  cos(angle*PI/180.0)*udv.at(X) + sin(angle*PI/180.0)*udv.at(Y);
        double y = -sin(angle*PI/180.0)*udv.at(X) + cos(angle*PI/180.0)*udv.at(Y);
        udv.at(X) = x / sqrt(x*x+y*y);
        udv.at(Y) = y / sqrt(x*x+y*y);
    }    
    cout << static_cast<int>(cur_position.at(X)) << " " << static_cast<int>(cur_position.at(Y)) << endl;

    return 0;
}

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

int main(){
	double x = 0.0;
	double y = 0.0;
	double angle = 90.0;
	for(;;){
		double hos;
		double change;
		char c;
		cin >> hos >> c >> change;
		if(hos == 0 && change == 0) break;
		x += hos * cos(angle * 3.14159 / 180);
		y += hos * sin(angle * 3.14159 / 180);
		angle -= change;
	}
	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))

int main()
{
	int x, r, R = 0;
	pair<double, double> point = mp(0, 0);

	while(cin >> x >> r && (x || r))
	{
		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;
#define rad(x) x * M_PI / 180

int main(){
  double x = 0.0;
  double y = 0.0;
  int angle = 0.0;
  int d = 0;
  int r = 0;

  while (1){
    scanf("%d, %d", &r, &d);
    if (r == 0 && d == 0) break;
    y += r * sin(rad(angle));
    x += r * cos(rad(angle));

    angle += d;
  }

  printf("%.0lf\n%.0lf\n", y, x);
  return 0;
}

C++: //C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
double pi=3.14159265358;
int main(){
  double now=pi*0.5;
  double x=0.0,y=0.0;
  while(1){
    double a,b;
    scanf("%lf,%lf",&a,&b);
    if (a==0.0 and b==0.0)break;
    double xx=0.0,yy=0.0;
    xx=cos(now)*a;
    yy=sin(now)*a;
    x+=xx;
    y+=yy;
    now-=(b/180*pi);
    if(now>=2*pi)now-=2*pi;
    if(now<=-2*pi)now+=2*pi;
    
    
    
  }  
  printf("%d %d\n",(int)x,(int)y);
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
 
using namespace std;
 
int main(int argc, char *argv[]) {
  int a, b;
  double x, y, angle;
 
  x = y = angle = 0.0;
 
  while (true) {
    scanf("%d,%d", &a, &b);
    if (a == 0 && b == 0)
      break;
    y += a * cos(angle / 180 * M_PI);
    x += a * sin(angle / 180 * M_PI);
    angle += b;
  }
 
  cout << (int)x << endl;
  cout << (int)y << endl;
  return 0;
}

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

#define PI 3.1415926535898
#define ANGLE (PI/180.0)
int main(){
	int step,dir;
	double x=0.0, y=0.0, angle=0.0;
	
	while(1){
		scanf("%d,%d", &step, &dir);
		if(step==0 && dir==0) break;
		x += (double)(step) * sin( angle*ANGLE );
		y += (double)(step) * cos( angle*ANGLE );
		angle += (double)dir;
	}
	printf("%d\n%d\n", (int)x, (int)y);
}

C++: #include<iostream>
#include<cmath>
using namespace std;
double a, b; int c, d, e; char f;
#define A(D) sin(D*0.01745329252)
#define B(D) cos(D*0.01745329252)
int main() {
	while (true) {
		cin >> c >> f >> d;
		if (c == 0 && d == 0) { break; }
		a += 1.0*A(e) * c;
		b += 1.0*B(e) * c;
		e += d;
	}
	cout << (int)a << endl << (int)b << endl;
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long llong;
double digrad(double dig) { return dig*M_PI / 180.0; }
int main() {
	double d, a,q=90;
	double x = 0, y = 0;
	char f;

	double rad=M_PI*q/180;
	while (true) {
		cin >> d >> f >> a;
		if (d == 0 && a == 0)break;
		x += d*cos(digrad(q));
		y += d*sin(digrad(q));
	????????????//cout << "x: " << x << "  y: " << y << endl;
		q -= a;
	}
	x = (int)x;
	y = (int)y;
	cout << x << endl << y << endl;

	return 0;
}

C++: #include<iostream>
#include<math.h>
using namespace std;

int main(){
	double x,y,dx,dy,pi,d,rad,prad;
	char camma;
	x=y=0;
	pi=3.14159265359;
	prad=0;
	while(cin>>d>>camma>>rad){
		if(d==0 && rad==0)break;
		dx=d*cos((rad+prad)*pi/180);
		dy=d*sin((rad+prad)*pi/180);
		x+=dx;
		y+=dy;
		prad=rad+prad;
		//cout<<"x:"<<x<<endl;
		//cout<<"y:"<<y<<endl;
	}
	cout<<(int)x<<endl;
	cout<<(int)y<<endl;
	while(1);
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<stdio.h>
#define PI 3.141592653589793
using namespace std;

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

	int l, a;

	while(scanf("%d,%d",l,a) != -1){
		x += l * cos(a * PI / 180);
		y += l * sin(a * PI / 180);
	}

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

	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <math.h>

#define PI 3.1415926535897932386

using namespace std;

int main(void){
	int i,j,angle=0;
	double x=0.0, y=0.0;
	while(scanf("%d,%d",&i,&j) != EOF){
		if(i==0&&j==0) break;
		x+= (double)(i)*sin((double)angle*PI/180);
		y+= (double)(i)*cos((double)angle*PI/180);
		angle += j;
	}
	cout << (int)x << "\n" << (int)y << "\n";
	return 0;
}