Advertisement
Griwin

Задача 2

Nov 9th, 2022
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | Source Code | 0 0
  1. #include<stdio.h>
  2. #include <cstdio>
  3. #include <iostream>
  4. using namespace std;
  5. int main()
  6. {
  7.     int i = 0;
  8.     char str[10];
  9.     printf("Enter String : ");
  10.     fgets(str,100,stdin);
  11.     while (str[i] != '\0')
  12.     {
  13.         if (str[i] == 'a')
  14.         {
  15.             str[i] = '*';
  16.         }
  17.         i++;
  18.     }
  19.     printf("-------------------------------------");
  20.     printf("\nString After Replacing 'a' by '*'");
  21.     printf("\n-------------------------------------\n");
  22.     printf("%s", str);
  23.     system("pause");
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement