Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var x, y float64
	angle := 90.0

	for sc.Scan() {
		data := strings.Split(sc.Text(), ",")
		if data[0] == "0" && data[1] == "0" {
			break
		}
		meters, _ := strconv.Atoi(data[0])
		m := float64(meters)
		changedAngle, _ := strconv.Atoi(data[1])
		a := float64(changedAngle)

		radian := angle * math.Pi / 180
		x += m * math.Cos(radian)
		y += m * math.Sin(radian)
		angle -= a
	}
	fmt.Println(int(x))
	fmt.Println(int(y))
}

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

const double PI = 3.14159265358979323846;

struct Vec2
{
	double x;
	double y;
	Vec2( double ix, double iy ):x(ix),y(iy){}
};

class Turtle
{
	Vec2 pos;
	double angle;
public:
	void forward(double length)
	{
		pos.x += length * cos(angle);
		pos.y += length * sin(angle);
	}
	void rotate( double angle1 )
	{
		angle -= angle1;
	}
	Vec2 GetPos(){return pos;}
	Turtle() : pos(Vec2(0.0,0.0)), angle(0.0){}
	Turtle( Vec2 v, double a ) : pos(v), angle(a){}
};

int main()
{
	Turtle turtle;
	int l,a;
	while(scanf("%d,%d",&l,&a),l||a)
	{
		turtle.forward(l);
		turtle.rotate(a*PI/180.0);
	}

	int x = static_cast<int>( turtle.GetPos().x );
	int y = static_cast<int>( turtle.GetPos().y );
	std::cout << x << '\n' << y;
}

C++: #include <iostream>
#include <cmath>
#define PI 3.16
using namespace std;
int main() {
  int len, rot;
  float x, y, shita;
  x = y = shita = 0;
  while(1) {
    scanf("%d,%d", len, rot);
    if (len == 0 && rot == 0) {
      break;
    }
    x += cos(shita * PI / 180);
    y += sin(shita * PI / 180);
    shita += rot;
  }
  cout << x <<  endl;
  cout << y << endl;
  return 0;
}

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("%d\n%d\n", (int)y, (int)x);
  return 0;
}

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

using namespace std;

int main()
{
    int s, d;
    char dummy;

    double px = 0.0, py = 0.0;
    double dir = 90.0;

    while( cin >> s >> dummy >> d ) {
        if ( s == 0 && d == 0 )
            break;

        px += cos( dir * M_PI / 180.0 ) * s;
        py += sin( dir * M_PI / 180.0 ) * s;
        dir -= d;
    }

    cout << static_cast<int>( px ) << endl << static_cast<int>( py ) << endl;
}

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


int main()
{
	int x = 0, y = 0;
	double d = 0, a = 90, r = 360;
	while (d != 0 || r != 0) {
		scanf("%lf,%lf", &d, &r);
		x = x + d * cos(a / 360 * 2 * pi);
		y = y + d * sin(a / 360 * 2 * pi);
		a = a + r;
	}
	cout << x << endl << y << endl;
    return 0;
}

C++: #include<stdio.h>
#include<math.h>
#define M_PI 3.14159265358979

int main()
{
	int x=1,y=1;
	double r=90,k=0,h=0;
	for(;x!=0||y!=0;)
	{
		scanf("%d,%d",&x,&y);
		k+=x*sin(r*M_PI/180.0);
		h+=x*cos(r*M_PI/180.0);
		r-=y;
	}
	printf("%.0f\n%.0f\n",h,k);
	return 0;
}

C++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>

using namespace std;

typedef complex<double> P;

int main(){

	double x=0,y=0;
	double c_th = 90;
	double r,th; char c;
	while(cin>>r>>c>>th,(r||th)){
		x += r * cos(c_th * M_PI / 180);
		y += r * sin(c_th * M_PI / 180);
		c_th -= th;
	}

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

	return 0;
}

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

using namespace std;

const double Pi = 3.14159265;
const double Degree = Pi / 180;

int main(int argc, char const* argv[])
{
	double scale,dTheta,theta;
	double x,y;
	char comma;
	x = y = 0;
	theta = 0;

	while( cin >> scale >> comma >> dTheta && scale != 0 ){
		x += scale * cos( -theta * Degree );
		y += scale * sin( -theta * Degree );
		theta += dTheta;
	}
	cout << static_cast<int>(-y) << endl;
	cout << static_cast<int>(x) << endl;
	return 0;
}

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

int dtoi(double d)
{
  return d>0 ? floor(d) : ceil(d);
}

int main(void)
{
  double x = 0;
  double y = 0;
  int orientation = 90;
  while(1){
    int step,rotation;
    scanf("%d,%d", &step, &rotation);

    if(step==0 && rotation==0){
      printf("%d\n", dtoi(x));
      printf("%d\n", dtoi(y));
      break;
    }else{
      x += step*cos(orientation*M_PI/180);
      y += step*sin(orientation*M_PI/180);
      orientation -= rotation;
    }
  }

  return 0;
}

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

typedef long double ldouble;

const double PI = acos(-1.0);
const double eps = 1e-10;
int main()
{
	int d,t;
	double x=0,y=0;
    int dir = 0;
	while(scanf("%d,%d", &d, &t) &&(d||t))			//霎灘?0,0扈捺據
	{
	    double tt = dir * PI / 180.0;
		x -= d * sin(tt);						//隶。邂?		y += d * cos(tt);
	    dir -= t;
	}
	printf("%d\n%d\n", (int)x, (int)y);					//霎灘?

	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
double x,y,dir=M_PI/2.0;
int a,b;
char c;
int main(){
  x=y=0.0;
  while(cin>>a>>c>>b&&a){
    x-=cos(dir)*(double)a;
    y+=sin(dir)*(double)a;
    dir+=b/180.0*M_PI;
    while(dir>=2.0*M_PI)dir-=2.0*M_PI;
    while(dir<0.0)dir+=2.0*M_PI;
    
  }
  cout<<(int)x<<endl<<(int)y<<endl;
  return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 1e9
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  pair<double,double> now=mp(0.0,0.0);
  int a,b;
  double r=0;
  while(scanf("%d,%d",&a,&b),a+b){
    now.F+=cos((r*M_PI)/180)*a;
    now.S+=sin((r*M_PI)/180)*a;
    r+=b;
  }
  int aa=now.F,bb=now.S;
  cout<<bb<<endl<<aa<<endl;
  return 0;
}

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

int main(){
  int a,pre_d=90,d;
  double x=0,y=0;

  while(1){
    scanf(" %d,%d",&a,&d);
    if(a==0&&d==0) break;
    //std::cout << (double)a << (double)d <<std::endl;
    x += (double)a*cos((double)pre_d*M_PI/180);
    y += (double)a*sin((double)pre_d*M_PI/180);
    pre_d += -d;
  }
  //std::cout << (double)a << std::endl;
  printf("%d\n%d\n",(int)x,(int)y);

}

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

class THuman
{
public:
	void Move(int Distance);
	void Turn(int Degree);
	double GetIntegerPartX();
	double GetIntegerPartY();
	THuman();
private:
	double FX;
	double FY;
	int FDegree;
};

void THuman::Move(int Distance)
{
	FX += Distance * sin(FDegree * M_PI / 180);
	FY += Distance * cos(FDegree * M_PI / 180);
}

void THuman::Turn(int Degree)
{
	FDegree += Degree;
}

double THuman::GetIntegerPartX()
{
	double GaussX, FractionalX;
	FractionalX = modf(FX, &GaussX);
	return GaussX;
}

double THuman::GetIntegerPartY()
{
	double GaussY, FractionalY;
	FractionalY = modf(FY, &GaussY);
	return GaussY;
}

THuman::THuman()
{
	FX = 0;
	FY = 0;
	FDegree = 0;
}

int main()
{
	THuman Human;
	while(true){
		int Distance;
		int Degree;
		char Dummy;
		cin >> Distance >> Dummy >> Degree;
		if(Distance == 0 && Degree == 0) break;
		Human.Move(Distance);
		Human.Turn(Degree);
	}
	cout << fixed << setprecision(0) << Human.GetIntegerPartX() << endl << Human.GetIntegerPartY() << endl;
	return 0;
}