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 <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define fi first
#define se second
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return M_PI;
}
typedef set<int> set_i;
typedef set<string> set_s;
int INF=1000000;
int main(){
	int a,b;
	char c;
	double x=0, y=0, r=0;
	while(1){
		cin>>a>>c>>b;
		if(a==0&&b==0) break;
		x+=a*sin((pi()*r)/180);
		y+=a*cos((pi()*r)/180);
		r+=b;
	}
	cout<<(int)x<<endl;
	cout<<(int)y<<endl;
}

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

 
using namespace std;
 
int main(){
        double x=0.0,y=0.0;
        double nr=M_PI/2.0;
        int l,r;
        while(true){
                cin >> l;
		cin.ignore();
		cin >> r;
                if(!(l|r))
                        break;
                x+=l*cos(nr);
                y+=l*sin(nr);
                nr-=r*M_PI/180.0;
        }
        cout << (int)x << ' '<< (int)y <<  endl;
return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main(){
	char c;
	int deg = 90;
	P crt(0, 0);
	for (int x, y; cin >> x >> c >> y, (x | y) != 0; ) {
		P v = polar(1.0, deg * 3.141592 / 180);
		crt += v * (double)x;
		deg -= y;
	}
	cout << trunc(crt.real()) << endl << trunc(crt.imag()) << endl;
	
	return 0;
}

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

using namespace std;


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

	while(1){
		scanf("%d,%d", &r, &ang);
		if(r == 0 && ang == 0) break;

		x += r * sin(ang*M_PI/180);
		y += r * cos(ang*M_PI/180);
	}

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

	return 0;
}

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

double PI = 3.141592653589793238;

int main() {
	double x = 0.0, y = 0.0, dir = PI / 2;
	while (true) {
		int d, a;
		std::scanf("%d,%d", &d, &a);
		if (d == 0 && a == 0) break;
		x += std::cos(dir) * d;
		y += std::sin(dir) * d;
		dir -= a * PI / 180;
	}
	int ix = x, iy = y;
	std::cout << ix << std::endl << iy << std::endl;
	return 0;
}

C++: #include<iostream>
#include<cmath>
#define PI 3.14159265359

using namespace std;

int main(){
  int d, a = 90, a2; 
  double x,y;
  char c;
  while(cin >> d >> c >> a2){
    if(d == 0 && a == 0) break;
    else{
      double rad = a * (PI / 180.0);
      x += d * cos(rad);
      y += d * sin(rad);
      a += a2;
    }
  }
  cout << -(int)x << "\n" << (int)y << endl;
}

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

int main(){
    int d, t;
    double x=0,y=0;
    double angle=90;
    while(1){
        char c;
        cin>>d>>c>>t;
        if(d==0&&t==0)
            break;
        x+=d*cos(angle/180*acos(-1));
        y+=d*sin(angle/180*acos(-1));
        angle-=t;
    }
    cout<<(int)x<<endl;
    cout<<(int)y<<endl;
}

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

const double PI = 3.14159265359;

using namespace std;

int main() {
	double x = 0.0, y = 0.0;
	int d, a;
	int ca = 90; //????????????????????????
	scanf("%d,%d", &d, &a);	

	do {
		x += d * cos(ca / 180.0 * PI);
		y += d * sin(ca / 180.0 * PI);
		ca -= a;
		scanf("%d,%d", &d, &a);	
		
	} while(d != 0 || a!= 0);

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

	return 0;
}

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

struct THuman
{
	double X;
	double Y;
	int Degree;
};

THuman Move(int Distance, THuman Human)
{
	Human.Y += Distance * cos(Human.Degree * M_PI / 180);
	Human.X += Distance * sin(Human.Degree * M_PI / 180);
	return Human;
}

int main()
{
	THuman Human = {0, 0, 0};
	while(true){
		int Distance;
		int Degree;
		char Dummy;
		cin >> Distance >> Dummy >> Degree;
		if(Distance == 0 && Degree == 0) break;
		Human = Move(Distance, Human);
		Human.Degree += Degree;
	}
	double GaussX, FractionalX, GaussY, FractionalY;
	FractionalX = modf(Human.X, &GaussX);
	FractionalY = modf(Human.Y, &GaussY);
	cout << fixed << setprecision(0) << GaussX << endl << GaussY << endl;
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
int main()
{
	int k,h;
	double p,tt,yk,x=0,y=0,r,mk=0;
	p=atan(1.0) * 4.0;
	while(1){
		scanf("%d,%d",&h,&k);
		if(h==0&&k==0){
			break;
		}
		mk+=k;
		if(mk>=360){
			mk-=360;
		}
		if(mk<=360){
			mk+=360;
		}

		r=((90-mk)*p)/180;
		yk=cos(r)*h;
		tt=sin(r)*h;
		x+=yk;
		y+=tt;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

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

const double PI = 4 * atan(1);
int naturalPart(const double r){
    if(r>0) return floor(r);
    else    return ceil(r);
}

int main(){
    double x = 0, y = 0;
    int stride, dir = 90, rot;
    while(1){
        std::cin >> stride;
        x += stride * cos(dir * PI / 180);
        y += stride * sin(dir * PI / 180);
        std::cin.ignore() >> rot;
        if(!stride && !rot)
            break;
        dir -= rot;
    }
    
    std::cout << naturalPart(x) << '\n' << naturalPart(y) << std::endl;
    return 0;
}

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

#define PI (3.141592)

int main()
{
	int hosu, angle,angleplus;
	angle = 0;
	double x = 0,y=0;
	char c;
	while( cin >> hosu >> c >> angleplus ) {
		if( hosu == 0 && angleplus == 0 )
			break;
		x += hosu * sin(angle * PI / 180 );
		y += hosu * cos(angle * PI / 180 );
		angle += angleplus;
		
	}
	printf("%.0f\n%.0f",x-0.5,y-0.5);

	return 0;
}

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

int main() {
	double x=0, y=0, a, b, now = 90;
	char c;
	while (cin >> a >> c >> b, a || b) {
		x += a * cos(M_PI * now / 180);
		y += a * sin(M_PI * now / 180);
		now = now - b;
	}
	if (x >= 0) x = floor(x);
	else if (x < 0) x = ceil(x);
	if (y >= 0) y = floor(y);
	else if (y < 0) y = ceil(y);
		cout << x << " " << y << endl;
}

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

const double rad = (3.14159265 / 180);

int main(){

	int m, angle, sumangle = 0;
	double x = 0, y = 0;

	char c;

	while (std::cin >> m >> c >> angle, m || angle){

		x += (std::cos((90 - sumangle)*rad)*m);
		y += (std::sin((90 - sumangle)*rad)*m);
		sumangle += angle;
	}

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

	return 0;
}