제출 #1291492

#제출 시각아이디문제언어결과실행 시간메모리
1291492tunademayoscanf 함수 4 (BSC_0_6)C++20
컴파일 에러
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(); }

컴파일 시 표준 에러 (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