Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- void double_a(char string[], char result[])
- {
- int counter = 0;
- for (int i = 0; i < strlen(string); i++)
- {
- if (string[i] == 'a')
- {
- result[counter] = 'a';
- result[counter + 1] = 'a';
- counter += 2;
- }
- else
- {
- result[counter] = string[i];
- counter++;
- }
- }
- result[counter] = 0;
- }
- int main()
- {
- char base[30] = "Yoona eats flowers";
- char new_base[30];
- double_a(base, new_base);
- cout << new_base;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement