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++: //0016
// Time-stamp: <2012-07-10 18:45:05 naga>

#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#define PI 3.1415926535
using namespace std;


int main(){
  int walk, deg;
  double x, y;
  int direction;

  x = y = 0;
  direction = 90;
  while(true){
    //radian = (double)(direction * PI/ 180);
    scanf("%d,%d", &walk, &deg);
    if(!walk && !deg){
      break;
    }
    
    x += (double)walk * cos(direction * PI / 180);
    y += (double)walk * sin(direction * PI / 180);

    // 向きを変える。角度を360以下に
    direction += deg;
    if(direction > 360){
      direction = direction - 360;
    }
  }

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

  return 0;
}

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

int main(){
	int arg = 0, a, b;
	double px, py;
	px = py = 0;
	while(scanf("%d,%d", &a, &b), a != 0 && b != 0){
		py += a * cos(arg * M_PI / 180.);
		px += (arg < 0 ? -1 : 1) * a * sin(arg * M_PI / 180.);
		arg += b;
	}
	printf("%d\n%d\n", (int)(px), (int)(py));
	return 0;
}

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

int main(void){
    int a, b, theta=90;
    double x=0.0, y=0.0;
    double PI=3.14159265358;
    while(scanf("%d,%d",&a, &b)!=EOF){
        if(a+b==0) break;
        x+=(double)a*cos(theta*PI/180);
        y+=(double)a*sin(theta*PI/180);
        theta-=b;
    }
    cout << (int)x << "\n" << (int)y << "\n";
}

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

int main(){
  double ln,cta,x=0,y=0,angle=90.0;

  while(1){

  scanf("%lf,%lf",&ln ,&cta);
  if(ln==0&&cta==0)break;

  x += ln*cos((angle/180)*M_PI);
  y += ln*sin((angle/180)*M_PI);
  angle-=cta;
  }
  cout<< x <<"\n"<< y <<endl;

  return 0;
}

C++: #include<iostream>
#include<cmath>
#define _USE_MATH_DEFINES
#include<math.h>

using namespace std;

int main() {
	int dis, deg, theta=90;
	double x = 0, y = 0;
	char d;
	while (true) {
		cin >> dis >> d >> deg;
		if (dis == 0 && deg==0 ) {
			break;
		}
		else {
			x += dis * cos(theta*M_PI/180);
			y += dis * sin(theta*M_PI/180);
		}
		theta -= deg;


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

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int main() {
	double cx = 0, cy = 0;
	int angle = 0;
	for(int l, r; ~scanf(" %d,%d", &l, &r) && l && r;) {
		double rad = 3.141592653589793 * angle / 180;
		cx += l * sin(rad);
		cy += l * cos(rad);
		angle += r;
#if 0
		cout << "before" << endl;
		cout << rad << endl;
		cout << cx << endl;
		cout << cy << endl;
		cout << "after" << endl;
#endif
	}
	printf("%d\n%d\n", (int)cx, (int)cy);
	return 0;
}

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

int main(){
  double x=0;
  double y=0;
  double angle=0;
  double r,th;
  while(1){
    scanf("%lf,%lf",&r,&th);
    if(r==0&&th==0)break;
    x+=r*sin(M_PI*angle/90);
    y+=r*cos(M_PI*angle/90);
    angle+=th;
  }
  printf("%d\n%d\n",(int)x,(int)y);
  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.14159265359;
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);
    
    
    
    
  }  
  printf("%.0lf %.0lf\n",x,y);
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <stdio.h>

#define PI 3.14159265358979323846264

using namespace std;

int main()
{
	double x=0.0,y=0.0;
	int a,b,theta=0;

	scanf("%d,%d",&a,&b);
	while(a!=0 && b!=0){
		x+=a*sin(theta*PI/180.0);
		y+=a*cos(theta*PI/180.0);

		theta+=b;
		scanf("%d,%d",&a,&b);

	}

	printf("%d\n%d\n",(int)x,(int)y);

	return 0;
}

C++: #include<iostream>
#include<cmath>
#define rad(x) (x * 3.141592653589793) / 180
using namespace std;

int main(void){
  int m, n;
  int ansx,ansy;
  char chr;
  double x = 0, y = 0, a = 90.0;

  while(cin >> m >> chr >> n , m != 0 || n != 0){
    x += cos(rad(a)) * m;
    y += sin(rad(a)) * m;
    a -= n;
    if(a < 0)
      a += 360;
    if(a >= 360)
      a -= 360;
  }
  
  ansx = x;
  ansy = y;
  cout << ansx << endl << ansy << endl;
  return 0;
}

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

int main(){
	int arg = 0, a, b;
	double px, py;
	px = py = 0;
	while(scanf("%d,%d", &a, &b), a != 0 && b != 0){
		py += a * cos(arg * M_PI / 180.);
		px += (arg < 0 ? -1 : 1) * a * sin(arg * M_PI / 180.);
		arg += b;
		printf("%f %f\n", px, py);
	}
	printf("%d\n%d\n", (int)(px), (int)(py));
	return 0;
}

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

int main() {
	int dir=0, rad, adv;
	double x=0.0, y=0.0;
	while (scanf("%d, %d\n",adv,rad)) {
		if (adv==0&&rad==0) break;
		dir += rad;
		x += cos(dir)*adv;
		y += sin(dir)*adv;
	}
	int X = (int)x;
	int Y = (int)y;
	printf("%d\n%d",x,y);
}

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

#define PI 3.14159265359

int main() {
	double coor[3] = { 0,0,90 };
	int length, angle;
	while (1) {
		scanf("%d,%d", &length, &angle);
		if (length == 0 && angle == 0)break;
		coor[0] += (double)length * cos((double)coor[2] * PI / 180);
		coor[1] += (double)length * sin((double)coor[2] * PI / 180);
		coor[2] -= angle;
	}
	printf("%d\n%d\n", (int)coor[0], (int)coor[1]);
	return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#define PI 3.1415926535897932384626433
using namespace std;
int main(){
    double nowx=0,nowy=0,nowkaku=PI/2;
    while(1){
        double ho,kaku;
        scanf("%lf,%lf",&ho,&kaku);
        if(ho==0&&kaku==0)break;
        nowy+=sin(nowkaku)*ho;
        nowx+=cos(nowkaku)*ho;
        nowkaku+=PI/180*kaku;
    }
    printf("%d\n%d\n",(int)nowx,(int)nowy);
    return 0;
}