Demo entry 6729101

cout

   

Submitted by anonymous on Apr 01, 2018 at 12:51
Language: C++. Code size: 474 Bytes.

 int DEI(int * v, int st, int dr) {
   char rasp;
   int mijloc = (st + dr) / 2;
   cout << "Este " << mijloc << " nr ul cautat?:\n";
   cin >> rasp;
   if (rasp == 'd' || rasp == 'D') {
     return mijloc;
   } else if (rasp == '>') {
     return DEI(v, mijloc + 1, dr);
   } else {
     return DEI(v, st, mijloc);
   }
 }

 int main() {
   int a[10001], primul = 0, ultimul;
   cin >> ultimul;
   cout << DEI(a, primul, ultimul) << endl;
   return 0;
 }

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).