foo.cc:3:5: error: expected initializer before ‘if’
3 | if (n == 1)
| ^~
foo.cc:5:5: error: expected unqualified-id before ‘else’
5 | else if (n == 2)
| ^~~~
foo.cc:7:5: error: expected unqualified-id before ‘else’
7 | else
| ^~~~
foo.cc:9:1: error: expected declaration before ‘}’ token
9 | }
| ^
foo.cc: In function ‘int main()’:
foo.cc:13:5: error: ‘cin’ was not declared in this scope
13 | cin<<k1<<k2;
| ^~~
foo.cc:14:10: warning: statement has no effect [-Wunused-value]
14 | for (k1; k1<=k2; k1++)
| ^~
foo.cc:15:9: error: ‘cout’ was not declared in this scope
15 | cout<<def(k1);
| ^~~~
foo.cc:15:15: error: ‘def’ was not declared in this scope
15 | cout<<def(k1);
| ^~~