Advertisement
Courbe_Impliquee

a->b

Jun 4th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <conio.h>
  4. #include <string>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <clocale>
  8. using namespace std;
  9. int main() {
  10. setlocale(LC_ALL, "rus");
  11.  
  12. char str1[100];
  13.  
  14. cout << ("Введите строку: ");
  15. int l = 100;
  16. cin.getline(str1, l);
  17.  
  18. for (int i = 0, k = 0; i < strlen(str1); i++) {
  19. if (str1[i] == 'a')
  20. {
  21. for (int j = strlen(str1) + 1; j>i; j--){
  22. str1[j] = str1[j - 1];
  23. }
  24. str1[i + 1] = 'b';
  25.  
  26. }
  27.  
  28. }
  29.  
  30. puts(str1);
  31.  
  32. system("pause");
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement