Errors:
i) const int x; - uninitialized const ‘x’
ii) x = 10; - assignment of read-only variable ‘x’
iii) cin >> y; - ‘y’ was not declared in this scope
iv) return 0 - expected ‘;’ before ‘}’ token
The correct code would be:
#include <iostream>
using namespace std;
int main()
{
const int x = 10;
int y = 10;
cin >> y;
cout << x << " " << y;
return 0;
}
Comments
Leave a comment