Language: C++

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <math.h>
&#160;
void walk(double current_point[2], int r, int sum_theta) {
&#160; &#160; double pi = 3.14159265358979;&#160;
&#160; &#160; double rad = ((double)sum_theta / 180) * pi;
&#160; &#160; current_point[0] += r * sin(rad);
&#160; &#160; current_point[1] += r * cos(rad);
}
&#160;
int main() {
&#160; &#160; int r;
&#160; &#160; int theta;
&#160; &#160; int sum_theta = 0;
&#160; &#160; double current_point[2] = {0, 0};
&#160;
&#160; &#160; do {
&#160; &#160; &#160; &#160; scanf("%d,%d", &r, &theta);
&#160;
&#160; &#160; &#160; &#160; walk(current_point, r, sum_theta);
&#160; &#160; &#160; &#160; sum_theta += theta;
&#160; &#160; } while(r || theta);
&#160;
&#160; &#160; printf("%d\n", (int)current_point[0]);
&#160; &#160; printf("%d\n", (int)current_point[1]);
&#160;
&#160; &#160; return 0;
}

Compiler output:
a.cc:32:2: error: stray '#' in program
   32 | &#160;
      |  ^
a.cc:34:2: error: stray '#' in program
   34 | &#160; &#160; double pi = 3.14159265358979;&#160;
      |  ^
a.cc:34:9: error: stray '#' in program
   34 | &#160; &#160; double pi = 3.14159265358979;&#160;
      |         ^
a.cc:34:45: error: stray '#' in program
   34 | &#160; &#160; double pi = 3.14159265358979;&#160;
      |                                             ^
a.cc:35:2: error: stray '#' in program
   35 | &#160; &#160; double rad = ((double)sum_theta / 180) * pi;
      |  ^
a.cc:35:9: error: stray '#' in program
   35 | &#160; &#160; double rad = ((double)sum_theta / 180) * pi;
      |         ^
a.cc:36:2: error: stray '#' in program
   36 | &#160; &#160; current_point[0] += r * sin(rad);
      |  ^
a.cc:36:9: error: stray '#' in program
   36 | &#160; &#160; current_point[0] += r * sin(rad);
      |         ^
a.cc:37:2: error: stray '#' in program
   37 | &#160; &#160; current_point[1] += r * cos(rad);
      |  ^
a.cc:37:9: error: stray '#' in program
   37 | &#160; &#160; current_point[1] += r * cos(rad);
      |         ^
a.cc:39:2: error: stray '#' in program
   39 | &#160;
      |  ^
a.cc:41:2: error: stray '#' in program
   41 | &#160; &#160; int r;
      |  ^
a.cc:41:9: error: stray '#' in program
   41 | &#160; &#160; int r;
      |         ^
a.cc:42:2: error: stray '#' in program
   42 | &#160; &#160; int theta;
      |  ^
a.cc:42:9: error: stray '#' in program
   42 | &#160; &#160; int theta;
      |         ^
a.cc:43:2: error: stray '#' in program
   43 | &#160; &#160; int sum_theta = 0;
      |  ^
a.cc:43:9: error: stray '#' in program
   43 | &#160; &#160; int sum_theta = 0;
      |         ^
a.cc:44:2: error: stray '#' in program
   44 | &#160; &#160; double current_point[2] = {0, 0};
      |  ^
a.cc:44:9: error: stray '#' in program
   44 | &#160; &#160; double current_point[2] = {0, 0};
      |         ^
a.cc:45:2: error: stray '#' in program
   45 | &#160;
      |  ^
a.cc:46:2: error: stray '#' in program
   46 | &#160; &#160; do {
      |  ^
a.cc:46:9: error: stray '#' in program
   46 | &#160; &#160; do {
      |         ^
a.cc:47:2: error: stray '#' in program
   47 | &#160; &#160; &#160; &#160; scanf("%d,%d", &r, &theta);
      |  ^
a.cc:47:9: error: stray '#' in program
   47 | &#160; &#160; &#160; &#160; scanf("%d,%d", &r, &theta);
      |         ^
a.cc:47:16: error: stray '#' in program
   47 | &#160; &#160; &#160; &#160; scanf("%d,%d", &r, &theta);
      |                ^
a.cc:47:23: error: stray '#' in program
   47 | &#160; &#160; &#160; &#160; scanf("%d,%d", &r, &theta);
      |                       ^
a.cc:48:2: error: stray '#' in program
   48 | &#160;
      |  ^
a.cc:49:2: error: stray '#' in program
   49 | &#160; &#160; &#160; &#160; walk(current_point, r, sum_theta);
      |  ^
a.cc:49:9: error: stray '#' in program
   49 | &#160; &#160; &#160; &#160; walk(current_point, r, sum_theta);
      |         ^
a.cc:49:16: error: stray '#' in program
   49 | &#160; &#160; &#160; &#160; walk(current_point, r, sum_theta);
      |                ^
a.cc:49:23: error: stray '#' in program
   49 | &#160; &#160; &#160; &#160; walk(current_point, r, sum_theta);
      |                       ^
a.cc:50:2: error: stray '#' in program
   50 | &#160; &#160; &#160; &#160; sum_theta += theta;
      |  ^
a.cc:50:9: error: stray '#' in program
   50 | &#160; &#160; &#160; &#160; sum_theta += theta;
      |         ^
a.cc:50:16: error: stray '#' in program
   50 | &#160; &#160; &#160; &#160; sum_theta += theta;
      |                ^
a.cc:50:23: error: stray '#' in program
   50 | &#160; &#160; &#160; &#160; sum_theta += theta;
      |                       ^
a.cc:51:2: error: stray '#' in program
   51 | &#160; &#160; } while(r || theta);
      |  ^
a.cc:51:9: error: stray '#' in program
   51 | &#160; &#160; } while(r || theta);
      |         ^
a.cc:52:2: error: stray '#' in program
   52 | &#160;
      |  ^
a.cc:53:2: error: stray '#' in program
   53 | &#160; &#160; printf("%d\n", (int)current_point[0]);
      |  ^
a.cc:53:9: error: stray '#' in program
   53 | &#160; &#160; printf("%d\n", (int)current_point[0]);
      |         ^
a.cc:54:2: error: stray '#' in program
   54 | &#160; &#160; printf("%d\n", (int)current_point[1]);
      |  ^
a.cc:54:9: error: stray '#' in program
   54 | &#160; &#160; printf("%d\n", (int)current_point[1]);
      |         ^
a.cc:55:2: error: stray '#' in program
   55 | &#160;
      |  ^
a.cc:56:2: error: stray '#' in program
   56 | &#160; &#160; return 0;
      |  ^
a.cc:56:9: error: stray '#' in program
   56 | &#160; &#160; return 0;
      |         ^
a.cc:1:1: error: expected unqualified-id before '?' token
    1 | ?
      | ^
In file included from /usr/include/math.h:275,
                 from /usr/include/c++/14/cmath:47,
                 from /usr/include/c++/14/math.h:36,
                 from a.cc:31:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:382:1: error: '__intmax_t' does not name a type; did you mean '__int128_t'?
  382 | __MATHDECL (__intmax_t, fromfp,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:382:1: error: '__intmax_t' does not name a type; did you mean '__int128_t'?
  382 | __MATHDECL (__intmax_t, fromfp,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:387:1: error: '__uintmax_t' does not name a type; did you mean '__uint128_t'?
  387 | __MATHDECL (__uintmax_t, ufromfp,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:387:1: error: '__uintmax_t' does not name a type; did you mean '__uint128_t'?
  387 | __MATHDECL (__uintmax_t, ufromfp,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:393:1: error: '__intmax_t' does not name a type; did you mean '__int128_t'?
  393 | __MATHDECL (__intmax_t, fromfpx,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:393:1: error: '__intmax_t' does not name a type; did you mean '__int128_t'?
  393 | __MATHDECL (__intmax_t, fromfpx,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:399:1: error: '__uintmax_t' does not name a type; did you mean '__uint128_t'?
  399 | __MATHDECL (__uintmax_t, ufromfpx,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:399:1: error: '__uintmax_t' does not name a type; did you mean '__uint128_t'?
  399 | __MATHDECL (__uintmax_t, ufromfpx,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:382:1: error: '__intmax_t' does not name a type; did you mean '__int128_t'?
  382 | __MATHDECL (__intmax_t, fromfp,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:382:1: error: '__intmax_t' does not name a type; did you mean '__int128_t'?
  382 | __MATHDECL (__intmax_t, fromfp,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:387:1: error: '__uintmax_t' does not name a type; did you mean '__uint128_t'?
  387 | __MATHDECL (__uintmax_t, ufromfp,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:387:1: error: '__uintmax_t' does not name a type; did you mean '__uint128_t'?
  387 | __MATHDECL (__uintmax_t, ufromfp,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:393:1: error: '__intmax_t' does not name a type; did you mean '__int128_t'?
  393 | __MATHDECL (__intmax_t, fromfpx,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:393:1: error: '__intmax_t' does not name a type; did you mean '__int128_t'?
  393 | __MATHDECL (__intmax_t, fromfpx,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:399:1: error: '__uintmax_t' does not name a type; did you mean '__uint128_t'?
  399 | __MATHDECL (__uintmax_t, ufromfpx,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:399:1: error: '__uintmax_t' does not name a type; did you mean '__uint128_t'?
  399 | __MATHDECL (__uintmax_t, ufromfpx,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:382:1: error: '__intmax_t' does not name a type; did you mean '__int128_t'?
  382 | __MATHDECL (__intmax_t, fromfp,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:382:1: error: '__intmax_t' does not name a type; did you mean '__int128_t'?
  382 | __MATHDECL (__intmax_t, fromfp,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:387:1: error: '__uintmax_t' does not name a type; did you mean '__uint128_t'?
  387 | __MATHDECL (__uintmax_t, ufromfp,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:387:1: error: '__uintmax_t' does not name a type; did you mean '__uint128_t'?
  387 | __MATHDECL (__uintmax_t, ufromfp,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:393:1: error: '__intmax_t' does not name a type; did you mean '__int128_t'?
  393 | __MATHDECL (__intmax_t, fromfpx,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:393:1: error: '__intmax_t' does not name a type; did you mean '__int128_t'?
  393 | __MATHDECL (__intmax_t, fromfpx,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:399:1: error: '__uintmax_t' does not name a type; did you mean '__uint128_t'?
  399 | __MATHDECL (__uintmax_t, ufromfpx,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:399:1: error: '__uintmax_t' does not name a type; did you mean '__uint128_t'?
  399 | __MATHDECL (__uintmax_t, ufromfpx,, (_Mdouble_ __x, int __round,
      | ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:382:1: error: '__intmax_t' does not name a type; did you mean '__int128_t'?
  382 | __MATHDECL (__intmax_t, fromfp,,