Advertisement
Guest User

projectofdata

a guest
Sep 26th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #define sz 100
  4. using namespace std;
  5.  
  6. void encode(char *str, int p)
  7. {
  8. int len=strlen(str);
  9. for(int i=p; i<len; i+=p)
  10. {
  11. str[p]+=2;
  12. }
  13. cout<<str<<endl;
  14. }
  15.  
  16. int main()
  17. {
  18. char str[sz];
  19. int no;
  20. cin>>str;
  21. cin>>no;
  22.  
  23. encode(str,no);
  24. return 0;
  25. }
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40. #include <iostream>
  41. #include <cstring>
  42. using namespace std;
  43.  
  44. int *array_prequence(int *ar, int sz)
  45. {
  46. int *z=new int[sz];
  47. memset(z,0,sz*sizeof(int));
  48. for(int i=0; i<sz; i++)
  49. {
  50. int v=ar[i];
  51. z[v]+=1;
  52. }
  53. return z;
  54. }
  55.  
  56. int main()
  57. {
  58. int ar[10]={1,3,5,6,1,2,5,6,5,2};
  59. int *ptr,n;
  60. ptr=array_prequence(ar,10);
  61. cin>>n;
  62. cout<<ptr[n]<<endl;
  63. return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement