The first variable conflict problem solved for one hours, ....
The code is as follows: ↓
#include <stdio.h>#include<string.h>#defineN 200//maximum length of the input stringintMain () {//************************ input Start part ********************************printf"Please enter a string. (length within 200) \ n"); intI=0, j,k,temp,lowletters=0, capletters=0, num=0, spechar=0;//defining a Count variable CharStr1[n],str2[n]; Gets (STR1); //the string that receives the keyboard input is passed to the STR1 array//*********************** Sort Section ************************************strcpy (STR2,STR1); for(k=0; K<strlen (str2); k++) for(j=k+1; J<strlen (str2); J + +) { if(str2[j]>Str2[k]) {Temp=Str2[k]; STR2[K]=Str2[j]; STR2[J]=temp; } }//************************ judgment type part ***************************** while(Str1[i]) {if(str1[i]>='a'&&str1[i]<='Z') {printf ("\t%c\t is a lowercase letter \ n", Str1[i]); Lowletters++; } Else if(str1[i]>='A'&&str1[i]<='Z') {printf ("\t%c\t as capital letter \ n", Str1[i]); Capletters++; } Else if(str1[i]>='0'&&str1[i]<='9') {printf ("\t%c\t for number \ n", Str1[i]); Num++; } Else if(str1[i]<=127) {printf ("\t%c\t for special characters \ n", Str1[i]); Spechar++; } I++; }//*********************************** Total Statistics part **********************************printf"\n\n\t\t follows ASCII code from large to small after the string is:%s\n", STR2); printf ("\n\n\t\t string length is%d \ n", strlen (str1)); printf ("\t\t Total capital letters%d \ n", capletters); printf ("\t\t lowercase letters total%d \ n", lowletters); printf ("\t\t special characters total%d \ n", Spechar); printf ("There are%d \t\t numbers \ n", num);return 0;}
2016.06.06 Monday the C language sorts the strings from the ASCII code of the characters to the small size and prints out the total number of character types in the string