• 个人简介

    main.cpp: In function 'int main()':
    main.cpp:6:5: error: 'cout' was not declared in this scope
        6 |     cout << "Hello World";
          |     ^~~~
    main.cpp:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
        1 | #include <cstdio>
      +++ |+#include <iostream>
        2 | using namespace std;
    

    A: Where's your header <iostream>?
    B: Oh, I forgot to #include <iostream>.

    main.cpp:4:1: error: 'cout' does not name a type
        4 | cout << "Hello World";
          | ^~~~
    

    A: Where's the main function?
    B: Oh, I forgot the main function.

    main.cpp: In function 'int main()':
    main.cpp:5:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
        5 |     cout << "Hello World";
          |     ^~~~
          |     std::cout
    In file included from main.cpp:1:
    /usr/include/c++/15.1.0/iostream:65:18: note: 'std::cout' declared here
       65 |   extern ostream cout;          ///< Linked to standard output
          |                  ^~~~
    

    A: Where's the namespace std?
    B: Oh, I forgot using namespace std.

    main.cpp: In function 'int main()':
    main.cpp:6:26: error: expected ';' before 'return'
        6 |     cout << "Hello World"
          |                          ^
          |                          ;
        7 |     return 0;
          |     ~~~~~~                
    

    ...

  • 通过的题目

  • 最近活动

    This person is lazy and didn't join any contests or homework.

题目标签

2025
2
难度
2
时间
2
来源
2
威海市编程挑战赛
2
普及-
1
普及/提高-
1
}