#include <iostream>#include<sstream>#include<stdio.h>#include<string>using namespacestd;/*string a = "abc", placing a in the character array*/voidConvertstringStrChars[]) { /*the length of ABC is 3.*/
/*string a = "ABCDE" char aa[]=a; no, char aa[]= "123" can * / for(intI=0; I<str.size (); i++) {S[i]=Str[i]; }}voidChuli (CharA[],intN) { //3 Elements 2 order for(intj =1; j<n;j++ ){ for(intI=0; i<n-j;i++){ if(a[i]>a[i+1]) {inttemp=a[i];a[i]=a[i+1];a[i+1] =temp;} } } for(intm=0;m<3; m++) {cout<<a[m]; cout<<" ";} printf ("\ n");}intMain () {/*dynamic creation of 2 arrays*/ intnum; CIN>>num; Char*p=New Char[3]; string*str =New string[num]; /*Assigning a value to a string array*/ for(intI=0; i<num;i++){ stringA CIN >>a;//bad input string with C-specific scanfstr[i]=A; } for(intk=0; k<num;k++) {convert (str[k],p); Chuli (P,3); p[0]=' /'; } return 0;}
#include <iostream>#include<sstream>#include<stdio.h>#include<string>using namespacestd; //Enter a character and then sort each character, the interface definition of the seed function is obviously voidChuli (stringa) {//algorithm is very simple Ah, the syntax details are too holeintN =a.size (); //3 Elements 2 order for(intj =1; j<n;j++ ){ for(intI=0; i<n-j;i++){ if(a[i]>a[i+1]) {inttemp=a[i];a[i]=a[i+1];a[i+1] =temp;} } } for(intm=0;m<3; m++) {cout<<a[m]; cout<<" ";} printf ("\ n");}intMain () {//string AA = "abc"; //Although there is an array of [], but cannot be passed to the character array//printf ("%c", Aa[3]);//0 is a 1 is B 2 is C 3 is ' s ' 4 is casual character//if (aa[3]== ') cout << "123"; This can be output! intnum; CIN>>num; string*str =New string[num]; /*Assigning a value to a string array*/ for(intI=0; i<num;i++) {cin>>str[i];//bad input string with C-specific scanf } for(intk=0; k<num;k++) {Chuli (str[k]); } return 0;}
Nanyang Oj-ascii Code Sort-spent a night