记录详情

Compile Error

foo.cc: In function 'int main()':
foo.cc:6:17: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
    6 |         printf(c=a+b);
      |                ~^~~~
      |                 |
      |                 int
In file included from foo.cc:1:
/nix/store/1x86jfiwsp5qi448fcdkkzn7vmx4krv2-glibc-2.35-163-dev/include/stdio.h:356:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  356 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
foo.cc:7:15: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
    7 |         scanf(c);
      |               ^
      |               |
      |               int
In file included from foo.cc:1:
/nix/store/1x86jfiwsp5qi448fcdkkzn7vmx4krv2-glibc-2.35-163-dev/include/stdio.h:421:42: note:   initializing argument 1 of 'int scanf(const char*, ...)'
  421 | extern int scanf (const char *__restrict __format, ...) __wur;
      |                   ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
foo.cc:10:13: error: redeclaration of 'int a'
   10 |         int a,b,c;
      |             ^
foo.cc:5:9: note: 'int a' previously declared here
    5 |     int a,b,c;
      |         ^
foo.cc:10:15: error: redeclaration of 'int b'
   10 |         int a,b,c;
      |               ^
foo.cc:5:11: note: 'int b' previously declared here
    5 |     int a,b,c;
      |           ^
foo.cc:10:17: error: redeclaration of 'int c'
   10 |         int a,b,c;
      |                 ^
foo.cc:5:13: note: 'int c' previously declared here
    5 |     int a,b,c;
      |             ^
foo.cc:11:15: error: invalid operands of types 'int(const char*, ...)' and 'int' to binary 'operator>>'
   11 |         printf>>a>>b;
      |         ~~~~~~^~~
      |         |       |
      |         |       int
      |         int(const char*, ...)
foo.cc:13:9: error: 'cout' was not declared in this scope
   13 |         cout<<c<<endl;
      |         ^~~~
foo.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    1 | #include <stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
foo.cc:13:18: error: 'endl' was not declared in this scope
   13 |         cout<<c<<endl;
      |                  ^~~~
foo.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; did you forget to '#include <ostream>'?
    1 | #include <stdio.h>
  +++ |+#include <ostream>
    2 | using namespace std;
foo.cc:16:13: error: redeclaration of 'int a'
   16 |         int a,b,c;
      |             ^
foo.cc:5:9: note: 'int a' previously declared here
    5 |     int a,b,c;
      |         ^
foo.cc:16:15: error: redeclaration of 'int b'
   16 |         int a,b,c;
      |               ^
foo.cc:5:11: note: 'int b' previously declared here
    5 |     int a,b,c;
      |           ^
foo.cc:16:17: error: redeclaration of 'int c'
   16 |         int a,b,c;
      |                 ^
foo.cc:5:13: note: 'int c' previously declared here
    5 |     int a,b,c;
      |             ^
foo.cc:17:15: error: invalid operands of types 'int(const char*, ...)' and 'int' to binary 'operator>>'
   17 |         printf>>a>>b;
      |         ~~~~~~^~~
      |         |       |
      |         |       int
      |         int(const char*, ...)
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
自测
题目
P1078 xf1-1两数和、积、余
语言
C++
递交时间
2022-08-27 08:38:47
评测时间
2022-08-27 08:38:47
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes