답안 #147953

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
147953 2019-08-31T10:09:18 Z 연구맨(#3667, foja001) 백점을 받아랏! (FXCUP4_hundred) C++17
컴파일 오류
0 ms 0 KB
#include "hundred.h"
#include <string>
std::string GetHundredPoints(int A, int B, int C) {
    string strA;
    if (max(A, max(B, C) == A) {
        strset(strA, "A", 100);
        Mark(strA);
    } else if (max(A, max(B, C) == B) {
        strset(strA, "B", 100);
        Mark(strA);
    } else if (max(A, max(B, C) == C) {
        strset(strA, "C", 100);
        Mark(strA);
    }

Compilation message

hundred.cpp: In function 'std::__cxx11::string GetHundredPoints(int, int, int)':
hundred.cpp:4:5: error: 'string' was not declared in this scope
     string strA;
     ^~~~~~
hundred.cpp:4:5: note: suggested alternatives:
In file included from /usr/include/c++/7/string:39:0,
                 from hundred.h:2,
                 from hundred.cpp:1:
/usr/include/c++/7/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'
   typedef basic_string<char>    string;
                                 ^~~~~~
/usr/include/c++/7/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'
hundred.cpp:5:16: error: 'max' was not declared in this scope
     if (max(A, max(B, C) == A) {
                ^~~
hundred.cpp:5:16: note: suggested alternative:
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/string:40,
                 from hundred.h:2,
                 from hundred.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:265:5: note:   'std::max'
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
hundred.cpp:5:9: error: 'max' was not declared in this scope
     if (max(A, max(B, C) == A) {
         ^~~
hundred.cpp:5:9: note: suggested alternative:
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/string:40,
                 from hundred.h:2,
                 from hundred.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:265:5: note:   'std::max'
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
hundred.cpp:5:32: error: expected ')' before '{' token
     if (max(A, max(B, C) == A) {
                                ^
hundred.cpp:14:5: error: expected statement at end of input
     }
     ^
hundred.cpp:5:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (max(A, max(B, C) == A) {
     ^~
cc1plus: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
hundred.cpp:14:5: error: expected '}' at end of input
     }
     ^
hundred.cpp:14:5: warning: no return statement in function returning non-void [-Wreturn-type]