|
From: Ioannis V. <no...@ya...> - 2001-10-03 09:57:38
|
I made some ommitions so i resend corrected.
The following code works for ASCII code *only* and for capitals only.
#include <string.h>
/* ... */
int i;
const int appearances[Z]=3D{0};
char buffer[80];
size_t slength;
/* You store the string to buffer here... */=20
slength=3Dstrlen(buffer);
for(i=3D0; i<slength; i++)
appearances[buffer[i]]++;
/* Now you have stored the number of appearances of each letter. */
The most important code was solved, now i guess you can think of
something to sort the letters (sorting function) according to your
criteria.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.f2s.com
* Alternative URL: http://run.to/noicys
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf=20
> Of Mansoor Nathani
> Sent: Wednesday, October 03, 2001 1:02 AM
> To: dev...@li...
> Subject: [Dev-C++] HELP !
>=20
>=20
> Hi this is my first post to the list
>=20
> I was wondering if someone could please help me out with this problem:
>=20
>=20
> The program should take an input of upto 80 characters and
> sort the characters into order according to the order of=20
> their appearance in the string, skipping spaces. Eg:
> MISSISSIPPI MUD would output: MMIIIISSSSPPUD
>=20
> Any help would be much appreciated..
>=20
> Mansoor Nathani
>=20
>=20
> _______________________________________________
> Dev-cpp-users mailing list Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>=20
|