Skip to content

Instantly share code, notes, and snippets.

@vertrigo
Created November 27, 2012 18:56
Show Gist options
  • Select an option

  • Save vertrigo/4156250 to your computer and use it in GitHub Desktop.

Select an option

Save vertrigo/4156250 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
int i,j,k=0;
char *st="";
clrscr();
printf("Введите строку: \n");
scanf("%s",st);
printf("\nИсходная строка: \n%s \n",st);
for(i=0;i<strlen(st)-1;i++){
if (*(st+i)== 'A' && *(st+i+1) == 'B')
{
*(st+i) = 'C';
for(j=i+1;j<strlen(st);j++)
{
*(st+j)=*(st+j+1);
}
}
}
printf("Полученная строка:\n%s",st);
getch();
}
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
int i,j,k=0;
char *st="";
clrscr();
printf("Vvedite stroku: \n");
scanf("%s",st);
printf("\nIshodnaja stroka: \n%s \n",st);
for(i=0;i<strlen(st)-1;i++){
if (*(st+i)== 'A' && *(st+i+1) == 'B')
{
*(st+i) = 'C';
for(j=i+1;j<strlen(st);j++)
{
*(st+j)=*(st+j+1);
}
}
}
printf("Poluchennaja stroka:\n%s",st);
getch();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment