Skip to content

Instantly share code, notes, and snippets.

@vertrigo
Created December 9, 2012 12:23
Show Gist options
  • Select an option

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

Select an option

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