QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#93900#4413. Cyber LanguageTobo#Compile Error//C++20475b2023-04-03 19:38:412023-04-03 19:38:43

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-03 19:38:43]
  • 评测
  • [2023-04-03 19:38:41]
  • 提交

answer

void solve(){
    cin >> t;
    getchar();
    while(t --){
        getline(cin,st);
       string ans;
        for(int i= 0; i < st.size(); i++){
            if(i == 0) ans += char(st[i] -'a' + 'A');
            else if(st[i - 1] ==' ') ans += char(st[i] -'a' + 'A');
        }
        cout <<ans << endl;
        st.clear();
    }
}
signed main()
{
    // ios::sync_with_stdio(false);
    // cin.tie(0);
    // cout.tie(0);
    solve();
    return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:2:5: error: ‘cin’ was not declared in this scope
    2 |     cin >> t;
      |     ^~~
answer.code:2:12: error: ‘t’ was not declared in this scope
    2 |     cin >> t;
      |            ^
answer.code:3:5: error: ‘getchar’ was not declared in this scope
    3 |     getchar();
      |     ^~~~~~~
answer.code:1:1: note: ‘getchar’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
  +++ |+#include <cstdio>
    1 | void solve(){
answer.code:5:21: error: ‘st’ was not declared in this scope; did you mean ‘std’?
    5 |         getline(cin,st);
      |                     ^~
      |                     std
answer.code:5:9: error: ‘getline’ was not declared in this scope
    5 |         getline(cin,st);
      |         ^~~~~~~
answer.code:6:8: error: ‘string’ was not declared in this scope
    6 |        string ans;
      |        ^~~~~~
answer.code:8:24: error: ‘ans’ was not declared in this scope
    8 |             if(i == 0) ans += char(st[i] -'a' + 'A');
      |                        ^~~
answer.code:9:38: error: ‘ans’ was not declared in this scope
    9 |             else if(st[i - 1] ==' ') ans += char(st[i] -'a' + 'A');
      |                                      ^~~
answer.code:11:9: error: ‘cout’ was not declared in this scope
   11 |         cout <<ans << endl;
      |         ^~~~
answer.code:11:16: error: ‘ans’ was not declared in this scope
   11 |         cout <<ans << endl;
      |                ^~~
answer.code:11:23: error: ‘endl’ was not declared in this scope
   11 |         cout <<ans << endl;
      |                       ^~~~