The question is painfully simple and I feel that I am close, but I got stuck in the monitor and walked around. It is necessary that cout would output "Yes" if this is the first element and "No" if it is some other one. I know that if has to be described differently, but I just don’t know how to describe it.

#include<iostream> using namespace std; int main() { int _size; cin >> _size; int* tab = new int [_size]; int number; for(int i=0;i<_size;i++){ cin >> number; tab[i] = number; } for(int i=0; i<_size; i++) { if(tab[0]) cout << "Yes" << endl; else cout << "No" << endl; } } 
  • 2
    Well, not if(tab[0]) , but if (i == 0) - avp
  • Thank you so much - Comatose
  • 2
    And who will release the memory? Stroustrup? - isnullxbh
  • @isnullxbh, in this example, if we allocate a ring under the POD array, “release” is needed - if only for aesthetics. There is a good discussion ( stackoverflow.com/questions/420070/… ). - Majestio
  • one
    Purely nagging for the sake of - do not use the first character underscore in names ( _size ) - this is reserved for the compiler. - Harry

0