fork download
  1.  
  2. #include<iostream>
  3. using namespace std;
  4. int main()
  5. {
  6. int n,c=1,n_val,flag=0;
  7. cin>>n;
  8. int i=0,prev;
  9. while(i<n)
  10. {
  11. int curr;
  12. cin>>n_val;
  13. curr=n_val;
  14. if(i>0)
  15. {
  16. if(curr<=prev && a==0)
  17. {
  18. prev=curr;
  19. i++;
  20. }
  21. else if(curr>=prev && a==1)
  22. {
  23. prev=curr;
  24. i++;
  25. }
  26. else if(curr<=prev && a==1)
  27. {
  28. c = 0;
  29. }
  30. }
  31.  
  32. else
  33. {
  34. prev=curr;
  35. i++;
  36. }
  37. }
  38. if(c==1)
  39. {
  40. cout<<"true";
  41. }
  42. else
  43. cout<<"false";
  44.  
  45. }
  46.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
7
9 8 2 3 4 1 5
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:16:18: error: ‘a’ was not declared in this scope
 if(curr<=prev && a==0)
                  ^
stdout
Standard output is empty