How to sort multiple strings in C carriage returns between strings .

Updated on technology 2024-02-08
4 answers
  1. Anonymous users2024-02-05

    Just take a look at this one**.

    Hope it helps.

  2. Anonymous users2024-02-04

    Here are the specific steps:1Defines an array of five strings to store the strings that need to be sorted.

    2.Use the string handler strcmp() to compare the size of the two strings. If string 1 is smaller than string 2, the return value is a negative integer; If string 1 is larger than string 2, the return value is a positive integer; If the two strings are equal, the return value is Establish a nested loop, compare the size between each of the two strings, and sort the strings from smallest to largest.

    4.Outputs five sorted strings. Here's an example of an implementation:

    c#include #include int main() printf("The sorted string is:");for (i = 0; i < 5; +i) puts(str[i]);Output five strings after the destruction of the pants lead sorted return 0; Note that the gets() and puts() functions are used when importing and outputting strings, respectively. This is because gets() can input strings that contain spaces, while puts() automatically adds a line break at the end of the output string.

    Also pure picking, the string is larger when comparing using the strcmp() function.

    Be careful to place it in an if statement to meet the requirement of sorting from smallest to largest in the order of English characters. Hope this answer is helpful to you. If you still have any questions or need further help, please feel free to continue to consult the cave.

    You can beat the complete **.

    Whole duck. You sort it out.

  3. Anonymous users2024-02-03

    According to the requirements of the title, the C++ procedure for rent payment written by Cheating Mountain is as follows (see figure) <>

  4. Anonymous users2024-02-02

    To give you an idea, you can achieve lowercase sorting, programming itself should not be difficult for your program to write directly in three parts, lowercase sorting, uppercase sorting, and number sorting. These three parts can be done in cycles.

    This is done in lowercase sorting:

    1.Make two pointers to find from front to back (don't want to use pointers, just use the shaping mark subscript) 2Find two lowercase letters in turn, if the first should be after the second, swap the positions of the two 3

    The first pointer points to the position of the second, and the second continues to find the next lowercase letter, and repeats step 2 to the end of the end.

    4.Write down the number of lowercase letters. Repeat 1-3 more times n-1 times.

    In fact, it is to bubble up the lowercase letters, exclude the non-lowercase letters, and leave it untouched.

    Uppercase and numeric can be done in cycles.

    I won't write out the ** for the specific implementation, and ask if you don't understand.

Related questions
6 answers2024-02-08

Define the struct:

typedef struct _legaladdress_{ >>>More

4 answers2024-02-08

2. 1, True 2, False (there is only one program) 3, False (not necessarily) 4, True. >>>More

15 answers2024-02-08

C++ is an object-oriented language, not very easy to learn, because it is more flexible, so there are a lot of problems to consider when doing programs! Because of the direct operation of the hardware, it inherits the advantages of the C language, so it is very efficient, and is generally used for the underlying and embedded systems.

24 answers2024-02-08

Operate from right to left, -i--so calculate -i first--, the operation level is higher, so it can be written as -(i--)i--for 8, add a - sign, so -i--is 8, at this time i--after, i=7, and then -i++ is the same, can be written as -(i++) so -i++ is -7, at this time i++ becomes 8,--i, subtract 1 before execution, so --i is 7, at this time i=7, ++i is the same, add 1 before executing i, so ++i is 8, at this time i=8, then calculate i--,i--is still equal to 8, then i minus one becomes 7, i++, i++ is equal to 7, and then i++, i=8, so finally i=8, and then print it out in turn, pay attention to the operation is from right to left, but print from left to right print i,i++,i--,i,--i,-i++,i-, so the check mark result is out.