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<cmath>

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("%.0f\n%.0f\n",x,y);

}

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

int main() {
 int a,b,r=90;
 double x=0,y=0;
 char c;
 while(true) {
 scanf("%d%c%d",&a,&c,&b);
 if (a==0 && b==0) break;
 x+=a*cos(3.141592*r/180);
 y+=a*sin(3.141592*r/180);
 r-=b;
 }
 cout << (int)x << endl << (int)y << endl;
 return 0;
}

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

using namespace std;
#define PI 3.1415926535897932

int main(){
	double x=0.0, y=0.0;
	int	dir=90, step, ang;
	char dmy;

	while(1){
	cin >> step >> dmy >> ang;
	if((step==0) && (ang==0)){
		cout<< (int)x << endl << (int)y << endl;
		return 0;
	}
		x+=(cos((long double)dir/180*PI)*step);
		y+=(sin((long double)dir/180*PI)*step);

		dir=(dir-ang)%360;
	}
}

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;

#define PI 3.141592

int main(){

	int a,b; int 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*PI/180);
	y+=a*sin(c*PI/180);
	c-=b;

	}

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

	return 0;

    }

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

int main()
{
	int len, angle;
	int sum_ang = 90; // start
	double x = 0.0, y = 0.0;

	// ang(+) -> right 
	while (scanf("%d,%d", &len, &angle), len != 0 && angle != 0){
		x += len * cos(M_PI * sum_ang / 180.0);
		y += len * sin(M_PI * sum_ang / 180.0);

		sum_ang = (sum_ang - angle + 360) % 360;
	}

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

	return (0);
}

C++: #define _USE_MATH_DEFINES
#include <complex>
#include <cmath>
#include <cstdio>

using namespace std;

int main()
{
	double current_angle_in_degree = 0;
	complex<double> current_position = 0;

	int input_distance = 0, input_angle_in_degree = 0;
	while (scanf("%d,%d", &input_distance, &input_angle_in_degree) == 2) {
		if (input_distance == 0 && input_angle_in_degree == 0) {
			break;
		}
		double angle_in_radian = current_angle_in_degree * M_PI / 180.0;
		current_position += static_cast<double>(input_distance)
			* complex<double>(cos(angle_in_radian), sin(angle_in_radian));
		current_angle_in_degree += input_angle_in_degree;
	}

	printf("%d\n%d\n",
		 static_cast<int>(current_position.imag()),
		 static_cast<int>(current_position.real()));

	return 0;
}

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

#define PI 3.14159265

int main(void){
    double x,y,curAn;
    int theta, r;
    
    x = y = 0;
    curAn = 0;
    while (scanf("%d,%d", &r, &theta)){
        if (theta==0 && r==0) break;
        x -= r*cos(curAn);
        y += r*sin(curAn);
        curAn = theta * 2 * PI /360.0;
    }
    printf("%d\n%d\n", (int)x, (int)y);
    return 0;
}

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

int main(){
double x,y,angle,t,r;
x=0;
y=0;
angle=M_PI/2;
while(1){
scanf("%lf,%lf",&r,&t);
if(r==0&&t==0)break;
x+=r*cos(angle);
y+=r*sin(angle);
angle+=t*M_PI/180;
}
printf("%d\n%d\n",(int)-x,(int)y);
return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

int main()
{	
	double posX=0;
	double posY=0;
	double angle=90;
	string str;
	while(getline(cin,str,',')){
		string str2;
		getline(cin,str2);

		int a,b;
		sscanf(str.c_str(),"%d",&a);
		sscanf(str2.c_str(),"%d",&b);

		if(a==0 && b==0) break;

		posX -= a * sin(M_PI/2.0 -angle/180.0*M_PI);
		posY += a * cos(M_PI/2.0 -angle/180.0*M_PI);

		angle += b;	
		cout << posX << ":" << posY << endl;
	}
	printf("%.0f\n%.0f\n",posX,posY);
}

C++: #include <bits/stdc++.h>

using namespace std;

#define PI 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679L

int main()
{
	long double x , y;
	char c;
	long double nowX = 0.0L , nowY = 0.L , nowA = 0.L;
	while(cin >> x >> c >> y , x || y)
	{
		nowX += cosl(PI*nowA / 180.L)*x;
		nowY += sinl(PI*nowA / 180.L)*x;
		nowA += y;
		if(nowA > 360.L)
		{
			nowA -= 360.L;
		} else if(nowA < 0.0L)
		{
			nowA += 360.L;
		}
	}
	cout << ( long long int )nowY << endl << ( long long int )nowX << endl;
}

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<<' '<<(int)y<<endl;
  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(){

	int a; int b; int 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*M_PI/180);
	y+=a*sin(c*M_PI/180);
	c-=b;

	}

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

	int a; int b; double c=90; double x=0; double y=0;
	while(true){
	cin >> a >> b;
	if(a==0 && b==0) break;
	x+=a*cos(c*3.141592/180);
	y+=a*sin(c*3.141592/180);
	c-=b;

	}

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

	return 0;

    }