Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- int main(void) {
- //declaration
- int i, j, count;
- char str[25][25], temp[25];
- //Questions
- puts("How many strings u are going to enter?: ");
- scanf_s("%d", &count);
- puts("Enter Strings one by one: ");
- for (i = 0;i <= count;i++) {
- gets(str[i]);
- }
- //Sorting strings
- for (i = 0;i <= count;i++)
- for (j = i + 1;j <= count;j++) {
- if (strcmp(str[i], str[j])>0) {
- strcpy(temp, str[i]);
- strcpy(str[i], str[j]);
- strcpy(str[j], temp);
- }
- }
- //Printing
- printf("Order of Sorted Strings:");
- for (i = 0;i <= count;i++) {
- puts(str[i]);
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement