Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #define sz 100
- using namespace std;
- void encode(char *str, int p)
- {
- int len=strlen(str);
- for(int i=p; i<len; i+=p)
- {
- str[p]+=2;
- }
- cout<<str<<endl;
- }
- int main()
- {
- char str[sz];
- int no;
- cin>>str;
- cin>>no;
- encode(str,no);
- return 0;
- }
- #include <iostream>
- #include <cstring>
- using namespace std;
- int *array_prequence(int *ar, int sz)
- {
- int *z=new int[sz];
- memset(z,0,sz*sizeof(int));
- for(int i=0; i<sz; i++)
- {
- int v=ar[i];
- z[v]+=1;
- }
- return z;
- }
- int main()
- {
- int ar[10]={1,3,5,6,1,2,5,6,5,2};
- int *ptr,n;
- ptr=array_prequence(ar,10);
- cin>>n;
- cout<<ptr[n]<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement