Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. ///////////////////////////////////////////////////////////
  6.  
  7. void func(char* str) {
  8.     for (int i = 0; str[i] != 0; i++) {
  9.         if ((str[i] >= '0') & (str[i] <= '8')) {
  10.             str[i] = str[i] + 1;
  11.         }
  12.  
  13.         else if (str[i] == '9') {
  14.             str[i] = '0';
  15.         }
  16.  
  17.     }
  18. }
  19.  
  20. int main() {
  21.     char* temp_str = new char[7] { 'a' , '3' , '7' , '0' , '2' , 'd' , 0 };
  22.  
  23.     func(temp_str);
  24.  
  25.     cout << temp_str << endl;
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement