1. A article stores the words that appear in the array and sorted by the number of occurrences. Additional array storage space is a friend's problem because I have not been busy recently (to be bad) has no time to write.
#include Using Namespace std; char * p = str, * q = str, * str1, * q1; int Len = Strlen (STR) -1; str1 = new char [ LEN 2]; // if (! str1) cout << "Error!" << Endl; while (* p) {if (* p! = ') {if (* q ==' "|| * q == 0) {q1 = q; do {str1 [len] = * (- q); len-;} while (p! = Q); P = Q = Q1;} else q ;} else { STR1 [LEN] = ''; len -; p ; q ;}} str1 [Strlen (STR)] = * p; return str1;} int main () {cout << "Please enter the string you want to convert ! "<< Endl; char STR [80]; cin.getline (STR, 80); cout << change (str) << endl; system (" pause "); return 0;} I wrote.
#include using namespace std; char * rev (char * src) {char * b, * e, ch; b = src; strrev (src); while (* b) {while (Isspace (* b)) b; e = b; while (* e &&! Isspace (* e)) E; CH = * E, * E = '/ 0'; strrev (b); b = E, * E = CH } Return Src;} int main () {char A [80]; cout << "Please enter string" << Endl; cin.getline (A, 80); cout << rev (a) << endl; System ("pause"); return 0;}
A netizen wrote. Very good. Accept.
============================================================================================================================================================================================================= ===================
#include using namespace std; struct node {char * s; int num; node * next;}; node * OrderInsertNode (Node * & head, node * p) // sort {node * p1, * p2; if ( ! hEAD) // Shouni {Head = P; p-> next = 0; return head;} if (head-> num> = p-> NUM) // Put the head before {P-> Next = head; Head = P; return head;} p1 = p2 = head; while (p2-> next && p2-> num <= p-> num) {p1 = p2; p2 = p2-> next;} if (p2-> num <= P-> NUM) // Insert the middle {p2-> next = p; p-> next = 0;} else // Insert the tail. {P-> next = P2; p1-> next = p;} return head; } node * insertnode (node * & head, node * p) // build the list {node * q, * q1; if (! = p; p-> next = 0; P-> Num = 1; return head;} Q1 = q = head; while (q) // processing intermediate case {IF (strcmp (Q-> S, P-> s)) {q1 = q; q = q-> NEXT; } else {q-> Num = 1; return Hea D;}} if (! q) q1-> next = p; // Insert the tail Return Head;} Node * filespik (char * file) {char * p = file, * q = p, * q1, e; node * Head = 0, * head1 = 0, * word; while (* p) {while (! isalpha (* p)) p; // Point to the word start at Q1 = P; While (isalpha (* q1) && * q1) q1; // Point to the word end E = * Q1; // Leave COPY * Q1 = '/ 0'; // 结 Tail word = new node; Word-> s = new char [strlen p) 1]; STRCPY (Word-> S, P); // put in words word-> Num = 1; Word-> Next = 0;