Main.cc: In function ‘int main()’:
Main.cc:12:4: error: ‘k’ was not declared in this scope
k++;
^
Main.cc:4:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&d);
~~~~~^~~~~~~~~