Main.cc: In function ‘int main()’: Main.cc:27:22: error: ‘tot’ was not declared in this scope printf("%.2lf\n",tot / n); ^~~ Main.cc:14:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ~~~~~^~~~~~~~~ Main.cc:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&vec[i].t); ~~~~~^~~~~~~~~~~~~~~~