Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <math.h>
- int main() {
- system("cls");
- //INPUT - @STUDENT:ADD YOUR CODE FOR INPUT HERE:
- char a[5][30];
- for (int i = 0; i<5; i++) {
- fflush(stdin);
- scanf("%[^\n]", &a[i]);
- }
- int i, j;
- char temp[30];
- for (i = 5 - 1; i > 0; i--) {
- for (j = 0; j < i; j++) {
- if (strcmp(a[j], a[j+1]) > 0) {
- strcpy(temp, a[j]);
- strcpy(a[j], a[j+1]);
- strcpy(a[j+1], temp);
- }
- }
- }
- // Fixed Do not edit anything here.
- printf("\nOUTPUT:\n");
- //@STUDENT: WRITE YOUR OUTPUT HERE:
- printf("%s", a[0]);
- for(int i = 1; i<5; i++) printf(" %s", a[i]);
- //--FIXED PART - DO NOT EDIT ANY THINGS HERE
- printf("\n");
- system ("pause");
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement