Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "iostream"
- using namespace std;
- int main()
- {
- int mas[100];
- int n,i,k,op=2;
- cout << "razmer massiva:";
- cin >> n;
- cout << "massiv:";
- for (i = 0;i < n;i++)
- {
- cin >> mas[i];
- }
- cout << endl;
- for (;;)
- {
- i = 0;
- op = 2;
- cout << "poisk:";
- cin >> k;
- if (k == 1000) break;
- while (mas[i] != k && i < n)
- {
- i++; op += 2;
- }
- if (i == n) { cout << "ne naideno!" << endl << "operazii:" << op << endl << endl; continue; }
- cout << "mas[" << i << "]=" << k << endl << "operazii:" << op << endl<<endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment