Title Program to remove multiple spaces from a string. Author: Nandan Jain Visitor Submitted Source Code Author Email: nandan_jain@rediffmail.com Description: This program reads the string and removes multiple spaces. Hits: 2498 Since 25th November, 2003 Code: Select and Copy the Code #include<iostream.h> #include<conio.h> void main() { clrscr(); char s[50]="Earth on Planet",t[50]; char *s1=s; int i=0,j=0; for (i=0; s[i]!='\0'; i++) { if (*s1==' ') { while (*s1==' ') s1++; t[j++]=' '; t[j++]=*s1; } else t[j++]=*s1; s1++; } cout<<"You entered : "<<s<<endl; cout<<"After removing spaces : "<<t; getch(); }