fork download
  1. #include<iostream>
  2. #include<string>
  3. #include<math.h>
  4. using namespace std;
  5. int main(){
  6. int n,c;
  7. int min = INT_MAX;;
  8. cin >> n;
  9. int *a = new int[n];
  10. for (int i = 1; i <= n; i++){
  11. cin >> a[i];
  12. if (min >= a[i]){
  13. min = a[i];
  14. c = i;
  15. }
  16. }
  17.  
  18. cout << min<<" "<<c;
  19. system("pause");
  20. return 0;
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:7:12: error: ‘INT_MAX’ was not declared in this scope
  int min = INT_MAX;;
            ^~~~~~~
prog.cpp:7:12: note: ‘INT_MAX’ is defined in header ‘<climits>’; did you forget to ‘#include <climits>’?
prog.cpp:4:1:
+#include <climits>
 using namespace std;
prog.cpp:7:12:
  int min = INT_MAX;;
            ^~~~~~~
prog.cpp:19:8: warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Wunused-result]
  system("pause");
  ~~~~~~^~~~~~~~~
stdout
Standard output is empty