Text: |
ԲΠ= Ãîðáà÷åíêî Â.À.
Çàïèòàííÿ:/*
Ïðîãðàìà , ÿêà âèäàëÿº ïåðø³ ë³òåðè ñë³â ³ç ââåäåíîãî ñòð³íãó.
*/
#include <iostream.h>
#include <strings.h>
#define N 200
using namespace std;
void del_first_letters(char* x){
int i1 = 1; int i2 = 0;
char newstr[N];
while (*(x+i1)!='\0'){
if ((*(x+i1)!=' ' && *(x+i1-1)==' '))
{
i1++;
continue;
}
else
{
newstr[i2]=x[i1];
i1++;
i2++;
}
newstr[i2]='\0';
}
strcpy(x,&newstr[0]);
}
int main(){
char x[N];
cout<<" Enter STR : ";
cin.getline(x,N);
fflush(stdin);
cout<<" -> "<<x<<endl;
del_first_letters(&x[0]);
cout<<"\n\n\n RESULT = "<<x<<endl;
system("PAUSE");
}
====================================
|