Submission #1291492

#TimeUsernameProblemLanguageResultExecution timeMemory
1291492tunademayoscanf 함수 4 (BSC_0_6)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define FOR(i, l, r) for(int i = l ; i <= r ; i++)
#define REP(i, l, r) for(int i = l ; i < r ; i++)
#define fi first
#define se second

const bool Multitest = 0;

const int N = 2e5 + 10;
void work()
{
  string x;
    while(cin >> x) cnt++;
    cout << cnt;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int q = 1;

    if(Multitest)   cin >> q;

    while(q--) work();
}

Compilation message (stderr)

scanf4.cpp: In function 'void work()':
scanf4.cpp:16:21: error: 'cnt' was not declared in this scope; did you mean 'int'?
   16 |     while(cin >> x) cnt++;
      |                     ^~~
      |                     int
scanf4.cpp:17:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   17 |     cout << cnt;
      |             ^~~
      |             int