Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- int main()
- {
- int vet[23]={23,45,21,33,12,33,22,44,66,45,21,33,12,11,8,7,6,11,45,21,33,12,13};
- int s1[4]={45,21,33,12};
- int n=23;
- int m=4;
- int i=0;
- int j=0;
- int cont=0;
- bool trovato=true;
- while(i<n){
- if(vet[i]==s1[j]){
- while(j<m && trovato==true){
- if(vet[i]!=s1[j]){
- trovato=false;
- }
- j++;
- i++;
- }
- if(trovato==true)
- cont++;
- j=0;
- trovato=true;
- }
- i++;
- }
- cout<<cont;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement