Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func main() {
	scanner.Split(bufio.ScanWords)

	x, y := 0.0, 0.0
	rotate := 90.0

	for {
		line := nextString()
		if line == "0,0" {
			break
		}

		numbers := strings.Split(line, ",")
		di, _ := strconv.ParseFloat(numbers[0], 64)
		ai, _ := strconv.ParseFloat(numbers[1], 64)

		rotateRadian := math.Pi * rotate / 180.0
		x += di * math.Cos(rotateRadian)
		y += di * math.Sin(rotateRadian)

		rotate -= ai

		// fmt.Println(x, y)
	}

	fmt.Println(int(x))
	fmt.Println(int(y))
}

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

int main(){
	int r, d, sd=90;
	double x=0.0, y=0.0;
	while( scanf("%d,%d",&r,&d)==2 && !(r==0 && d==0) ){
		x += r * cos(sd*3.141592/180.0);
		y += r * sin(sd*3.141592/180.0);
		sd -= d;
		if( sd>180 )			sd -= 360;
		else if( sd<-180 )	sd += 360;
	}
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

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

#define PI 3.1415926535

int main() {
	int dir=90, rad, adv;
	double x=0.0, y=0.0;
	while (scanf("%d%*c%d",&adv,&rad)&&adv!=0.0&&rad!=0.0) {
		x += cos(dir*PI/180)*adv;
		y += sin(dir*PI/180)*adv;
		dir -= rad;
		if (dir < 0) dir += 360;
	}
	int X = (int)x;
	int Y = (int)y;
	printf("%d\n%d\n",X,Y);
}

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

int main(){
  const double PI=3.14159265358979;
  double inr=0,ind=0;
  double x=0,y=0;
  int degree=90;
  while(scanf("%lf,%lf",&inr,&ind) , inr||ind){
    y+=inr*sin(PI/180*degree);
    x+=inr*cos(PI/180*degree);
    degree-=ind;
  }
  x=(int)x;
  y=(int)y;
  cout<<x<<endl<<y<<endl;
  return 0;
}

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

int main(){
	double x = 0.0;
	double y = 0.0;
	double r = M_PI*0.5;
	while(1){
		int a,b;
		char com;
		cin >> a >> com >> b;
		if(a==0 && b==0) break;
		x += double(a)*cos(r);
		y += double(a)*sin(r);
		r -= M_PI*b/180.0;
	}
	int c = int(x);
	int d = int(y);
	cout << c << endl;
	cout << d << endl;
}

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(){

	P p;
	double c_r = 90;
	double x,r; char c;
	while(cin>>x>>c>>r,(x||r)){
		P add = P(x,0) * P(cos(c_r * M_PI / 180),sin(c_r* M_PI / 180));
		p += add;
		c_r -= r;
	}

	cout << (int)p.real() << endl << (int)p.imag() << endl;

	return 0;
}

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

int main() {
double r,th=0,x=0,y=0,kaku=0;
char d;
while(1){
	cin>>r>>d>>th;
	if(r==0&&th==0){
		break;
	}
	x=x+r*sin(kaku*PI/180);
	y=y+r*cos(kaku*PI/180);
	kaku=th+kaku;
}
int xx,yy;
xx=x;
yy=y;
cout<<xx<<endl;
cout<<yy<<endl;
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  double x=0,y=0,vec=90,dis,angle;
  for(;;){
    scanf("%lf,%lf",&dis,&angle);
    if(dis == 0 && angle == 0){break;}
    x+=dis*cos(vec*M_PI/180.0);
    y+=dis*sin(vec*M_PI/180.0);
    vec-=angle;
  }
  cout <<(int)x<<endl<<(int)y<<endl;
  return 0;
}

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_s("%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 DEG2RAD(X) ((X)/180.0*3.1415926535898) 
int main(void){
    double curX,curY;
    int curDir;
    double dx,dy;
    int dAngle,dDist;
    
    curX = curY = 0;
    curDir = 0; // north
    scanf("%d,%d",&dDist, &dAngle);
    while (dDist!=0 || dAngle!=0){
        curX += dDist * sin(DEG2RAD(curDir));
        curY += dDist * cos(DEG2RAD(curDir));
        curDir += dAngle;
        scanf("%d,%d",&dDist, &dAngle);
    } 
    printf("%d\n%d\n", (int)curX, (int)curY);
    return 0;
}

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

int main()
{
	int x=0,y=0,tmp_y = 0;
	double X=0,Y=0;
	char dummy;
	while(cin >> x >> dummy >> y){
		if(!x && !y)break;

		X += x*cos(tmp_y*3.14/180);
		Y += x*sin(tmp_y*3.14/180);

		tmp_y = y;
	}

	cout << X << endl << Y << endl;

	return 0;
}

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

using namespace std;

int main(){
	double sumX = 0;
	double sumY = 0;
	double d,rad = 3.1415/2;
	double theta;
	while(1){

		cin >> d ;
		getchar();
		cin >> theta;
		if(d == 0 and theta == 0) break;
		sumX += d * cos(rad);
		sumY += d * sin(rad);
		rad -= (3.1415*theta)/180.0;
	}

	cout << (int)sumX << " " << (int)sumY << endl;
	return 0;
}

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

int main(){
	double teku[10000]={0.0},sita=pi/2,set_sita[10000]={0.0},x=0.0,y=0.0;
	int i=0;
	
	while(scanf("%lf,%lf",&teku[i],&set_sita[i])!=EOF){
		if(teku[i]==0 && set_sita[i]==0)break;
		
		set_sita[i]=set_sita[i]/180.0 * pi;
		
		x+=teku[i]*cos(sita);
		y+=teku[i]*sin(sita);
		sita+=set_sita[i];
		i++;
	}
	if(x>0)x=floor(x);
	else x=ceil(x);
	
	if(y>0)y=floor(y);
	else y=ceil(y);
	
		printf("%.0f\n%.0f\n",floor(x),floor(y));
	return 0;
}

C++: #include <iostream>
#include <math.h>
#include <cstdio>
using namespace std;
#define PI 3.14159265
int main()
{
    double x=0,y=0;
    int r,dth,th=0;
    while(true){
        scanf("%d,%d",&r,&dth);
        if(!r&&!dth)break;
        x+=r*sin((double)th*PI/180);
        y+=r*cos((double)th*PI/180);
        th+=dth;
    }
    cout<<int(x)<<endl;
    cout<<int(y)<<endl;
    return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
#include <fstream>
#include <array>
#include <utility>
#include <functional>
#include <stack>
#include <math.h>

using namespace std;
typedef long long Int;
#define REP(i , x) for(Int i = 0 ; i < x ; ++i)
typedef pair<int, int> P;


int main()
{
	int a, b;

	double x = 0; 
	double y = 0;
	int radius = 90;


	while (scanf("%d,%d", &a, &b), a||b){
		y += a*sin(radius*M_PI/180);
		x += a*cos(radius*M_PI/180);
		radius -= b;
	}
	y *= 10;
	int y_ = y;
	y_ %= 10;
	y_ /= 10;

	x *= 10;
	int x_ = x;
	x_ %= 10;
	x_ /= 10;

	cout << (int)y_ << endl << (int)x_ << endl;                                                        
	return 0;
}

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

typedef long double ldouble;

const double pi = acos(-1.0);
const double eps = 1e-10;

ldouble mysin(ldouble x) {
    double ret = 0.0, now = x, tt = x * x, k = 1;
    for(int i = 0; i < 1000; i++) {
        ret += now / k;
        now *= (-tt);
        k *= (2 * i + 2) * (2 * i + 3);
    }
    return ret;
}

ldouble mycos(ldouble x) {
    ldouble ret = 0.0, now = 1, tt = x * x, k = 1;
    for(int i = 0; i < 1000; i++) {
        ret += now / k;
        now *= (-tt);
        k *= (2 * i + 1) * (2 * i + 2);
    }
    return ret;
}
int main()
{
    //printf("%.20f %.20f\n", (double)mycos(PI / 3), cos(PI / 3));
	int d,t;
	double x=0,y=0;
    int dir = 0;
	while(scanf("%d%*c%d", &d, &t) &&d!=0&&t!=0)			//霎灘?0,0扈捺據
	{
//	    while(dir >= 360) dir -= 360;
//	    while(dir < 0) dir += 360;
		x -= d * sin((dir) * pi / 180.0);						//隶。邂?		y += d * cos((dir) * pi / 180.0);
	    dir -= t;
	}
	printf("%d\n%d\n", (int)x, (int)y);					//霎灘?

	return 0;
}