Go: package main

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

func main() {
	var a, b float64
	var x, y float64
	x = 0
	y = 0
	var now float64
	now = 90
	var info string
	for {
		fmt.Scan(&info)
		infos := strings.Split(info, ",")
		a_int, _ := strconv.Atoi(infos[0])
		b_int, _ := strconv.Atoi(infos[1])
		a = float64(a_int)
		b = float64(b_int)
		// println(a, b)
		if a == 0 && b == 0 {
			break
		}
		x += math.Cos(now*math.Pi/180)*a
		y += math.Sin(now*math.Pi/180)*a
		now -= b
	}
	fmt.Printf("%d\n%d\n", int(x), int(y))
}

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

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

#define M_PI 3.14159265358979323846

float dtor(int d){
	return d / 180.0 * M_PI;
}

int main(void){
	float x = 0.0, y = 0.0;
	int d = 0,a = 0, an = 90;

	while(true){
		scanf("%d,%d", &d, &a);
		printf("%d,%d\n", d, a);
		if(d == 0 && a == 0){ break; }
		x += d * cosf(dtor(an));
		y += d * sinf(dtor(an));
		an -= a;
	}
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

C++: #include <string>
#include <vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>

using namespace std;

int main(){

	double a,b; double c=90; double x=0; double y=0;
	while(true){
	scanf("%d %d",&a,&b);
	if(a==0 && b==0) break;
	x+=a*cos(c*3.141592/180);
	y+=a*sin(c*3.141592/180);
	c-=b;

	}

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

	return 0;

    }

C++: #include <stdio.h>
#include <math.h>
#define PI 3.141592653589
int main() {double corn=0.00,x=0.00,y=0.00;int i,j;while (1) {scanf("%d,%d",&i,&j);if (!i && !j) break;x+=i*sin(corn);y+=i*cos(corn);corn+=(j*PI)/180.00;}printf("%d\n%d\n",(int)(x),(int)(y));return 0;}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<iomanip>

#define EPS (1e-10)
using namespace std;
#define PI (3.1415926535)

int main(){
	int m, n;
	double x = 0, y = 0;
	double rad = PI/2;
	char in[10];
	const char *delim = ",";

	while(cin >> in){
		m = atoi(strtok(in, delim));
		n = atoi(strtok(NULL, delim));
		if( m == 0 && n == 0){
			break;
		}
		x += m * cos(rad);
		y += m * sin(rad);
		rad -= PI/180 * n;
	}

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

	return 0;
}

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

int main()
{
    double x = 0;
    double y = 0;
    double a = M_PI_2;
    while(true){
        int d, t;
        char c;
        std::cin >> d >> c >> t;
        if(d == 0 && t == 0) break;
        x += d * std::cos(a);
        y += d * std::sin(a);
        a += (-t * M_PI / 180);
    }
    double IntX, IntY;
    std::modf(x, &IntX);
    std::modf(y, &IntY);
    std::cout << std::fixed << std::setprecision(0);
    std::cout << IntX << std::endl;
    std::cout << IntY << std::endl;
    return 0;
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

int main() {
	double d = 0.0;	// ????????????????????¢
	double a = 0.0;	// ?????????????????????
	double x = 0.0;
	double y = 0.0;
	int ak = 90;	// ???????????????90????????????
	while (true)
	{
		scanf("%lf,%lf", &d, &a);	// double?????????????????????%f??§????????????%lf?????????
		cout << d << a << endl;
		if (d == 0 && a == 0) { cout << "???????????????" << endl;	break; }
		x += cos(ak*M_PI / 180) * d;
		y += sin(ak*M_PI / 180) * d;
		ak -= a;
		ak %= 360;
	}
	// ??????
	cout << (int)x << "\n" << (int)y << endl;
	return 0;
}