Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- char unos(char niz[], int a)
- {
- for (int i = 0; i<a; i++)
- for (;;)
- {
- cin >> niz[i];
- if
- ((niz[i]<'A' && niz[i]<'Z') && (niz[i]<'a' && niz[i]<'z'))
- break;
- else
- cout << "Pogresan unos!" << endl;
- }
- return 0;
- }
- void promijeni(char niz[], int niz2[], int a)
- {
- for (int i = 0; i<a; i++)
- {
- niz2[i] = niz[i];
- cout << niz2[i] << endl;
- }
- cout << endl;
- }
- bool pretraga(int niz[], int a, int b, int&c)
- {
- if (niz[a] == b)
- {
- c++;
- return true;;
- }
- return false;
- }
- int main()
- {
- char niz[5];
- int niz1[5];
- int b = 5;
- int c = 0;
- int d = 0;
- unos(niz, b);
- promijeni(niz, niz1, b);
- c = rand() % 100 + 8;
- for (int i = 0; i<b; i++)
- {
- pretraga(niz1, i, c, d);
- }
- cout << d;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment