cout << st << endl;
}
}
void del(char *st,int k,int n)
{
Int i;
for(i = k; i < strlen (st)-n; i++)
st[i] = st[i+n];
st[i] = '\0';
}
void* memchr (const void *st, int s,int n); ¾ " s " *st n , ', st. s , , NULL.
void* memcmp (const void *st, const void * s, n);
void* memicmp (const void *st, const void * s,int count); ¾ n s1 s2.
< 0 ¾ s1 < s2;
=0 ¾ s1 = s2;
>0 ¾ s1 > s2;
char *strset (char *st, int ch); ¾ st ch .
¾
ֳ < stdlib.h >
int atoi (const char *s); ¾ s int. . 0, , . , "2345", :
[ ] [ ] [ ].
long atol (const char *s); ¾ s long int ( atoi.)
double atof (const char *s); ¾ double. , 0.
:
[] [ ] [. ] [ ,,d D] [ ] [ ], -12345.123 -12. 345123 3
char *ecvt (double vl, int n, int *dec, int *sign); ¾ vl , n . , dec. sign. sign = 0 ¾ , ¾ 䒺. ' , .
har *fcvt (double vl, int n, int *dec, int *sign); ¾ , ecvt - dec , fcvt - .
har *gcvt (double vl, int n, har *buf); ¾ vl , , buf, n ¾ . , , n. . n, , . .
|
|
strlen (st) - st - '\0'.
¾
ֳ <ctype.h>:
isgraph (s) ¾ , s ( 0), s - .
isprint (s) ¾ , s , ( 0) .
ispunct (s) ¾ "" , s (- ( 0) .
isdigit (s) ¾ " " , s 0 9 ( 0) .
isalnum (s) ¾ " ", , s ( ) ( 0) ( ).,
tolower (s) ¾ s ;
toupper (s) ¾ s ;
atoi (s) ¾ s ;
atol (s) ¾ s ;
atof (s) ¾ s .
.
3.5 () .
//P3_5.CPP
#include <string.h>
#include < iostream>
Using namespace std;
Void main()
{
char mst[ 5] [15];
char *ps[5], *ptr;
int , n, k;
cout << " \n";
for(i = 0; i < 5; i++)
{
gets (mst [i]);
ps[i] = mst[i];
}
cout << "\n\t \n\n";
for(i = 0; i < 5; i++)
puts (ps[ i ]);
//
n = 5;
for (i = 1; i < n; i++) //
for (k = 0; k < (n i); k++)
if (strcmp (ps[k], ps[k+1]) > 0)
{
ptr = ps[k];
ps[k] = ps[k+1];
ps[k+1] = ptr;
}
cout << "\n\n\t ³ \n\n";
for (i = 0; i < 5; i++)
puts (ps[ i ]);
}
3.6 .
//P3_6.CPP (
#include <string.h>
#include < iostream>
Using namespace std;
Void main()
{
char st[] = " .";
Int i,j;
for (i = 0; i < strlen(st)-1; i++)
{
if ((st[i] == ' ') &&(st[i+1] == ' '))
{
for (j = i+1; j < strlen(st); j++)
st[j-1]=st[j];
I--;
}
cout << st;
Return 0;
}
3.7 .
//P3_7.CPP .
#include <string.h>
#include < iostream>
Using namespace std;
const int m = 50;
Void main()
{
char *pt, mainstr[m], substr[m];
int n, k = 0;
cout << " " << endl;
|
|