#include <iostream>
#include <stdlib.h>
#include <ctime>
using namespace std;
int main()
{
srand(time(0));
// the number of oranges
int n = 128;
// filling the array with oranges corresponding with their order the system find randomly the order of heavy orange
int heavy_orange_order;
heavy_orange_order = rand() % 120;
// the cycle of finding
int abstract_orange_order;
int steps_finding = 0;
while (true) {
cout << "Predict the heavy orange order: ";
cin >> abstract_orange_order;
if (abstract_orange_order != heavy_orange_order) {
steps_finding++;
}
if (abstract_orange_order == heavy_orange_order) {
cout << "Well!!! you find heavy orange." << endl;
cout << "The number of steps is that " << steps_finding + 1;
break;
}
}
return 0;
}
Comments
Leave a comment