/ SeriousOJ /

Record Detail

Compile Error

foo.cc: In function 'int main()':
foo.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |         cin >> t;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:146,
                 from foo.cc:1:
/usr/include/c++/13/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
foo.cc:7:9: error: 'string' was not declared in this scope
    7 |         string s;
      |         ^~~~~~
foo.cc:7:9: note: suggested alternatives:
In file included from /usr/include/c++/13/string:41,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52:
/usr/include/c++/13/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/13/string:66:11: note:   'std::pmr::string'
   66 |     using string    = basic_string<char>;
      |           ^~~~~~
foo.cc:8:30: error: 's' was not declared in this scope
    8 |         while (t-- && cin >> s)
      |                              ^
foo.cc:10:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 |                 cout << s[0] << "\n";
      |                 ^~~~
      |                 std::cout
/usr/include/c++/13/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~

Code

#include <bits/stdc++.h>

int main()
{
	int t;
	cin >> t;
	string s;
	while (t-- && cin >> s)
	{
		cout << s[0] << "\n";
	}
}

Information

Submit By
Type
Pretest
Problem
P1080 String Algorithm
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-19 20:21:14
Judged At
2024-11-11 03:07:13
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes