Guest
Login
跳过导航链接

Compile Error:

  :12:26: error: stray '\' in program
   12 |         cout<<double(sum)\n<<endl;
      |                          ^
: In function 'int main()':
:6:5: error: 'cin' was not declared in this scope
    6 |     cin>>n;
      |     ^~~
:3:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    2 | #include<cmath>
  +++ |+#include <iostream>
    3 | using namespace std;
:8:14: error: 'x' was not declared in this scope
    8 |         cin>>x;
      |              ^
:9:9: error: 'sum' was not declared in this scope
    9 |         sum+=x;
      |         ^~~
:11:9: error: 'cout' was not declared in this scope
   11 |         cout<<sum<<endl;
      |         ^~~~
:11:9: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
:11:15: error: 'sum' was not declared in this scope
   11 |         cout<<sum<<endl;
      |               ^~~
:11:20: error: 'endl' was not declared in this scope
   11 |         cout<<sum<<endl;
      |                    ^~~~
:3:1: note: 'std::endl' is defined in header '<ostream>'; did you forget to '#include <ostream>'?
    2 | #include<cmath>
  +++ |+#include <ostream>
    3 | using namespace std;

  

Zhe Jiang University Of Technology Online Programming Space Beta1.3
Designed & Developped By Jin Qiwei
Refactored By cb@zjut.edu.cn , QQ Group: 723311416  All Copyright Reserved 2006-
73