Advertisement
Coriic

Untitled

Dec 12th, 2015
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #define ROZMIAR 50
  4.  
  5. char c;
  6. int i, j, n, a;
  7.  
  8. void clear (void)
  9. {
  10. while ( getchar() != '\n' );
  11. }
  12.  
  13. int main(void){
  14. printf("Podaj ile stringow chcesz posortowac: ");
  15. scanf("%d", &n);
  16. char tab[n][ROZMIAR];
  17. int pom[n];
  18. for (i=0; i<n; i++){
  19. j=0;
  20. if (i==0) clear();
  21. printf("Podaj %d. string: ", i+1);
  22. for(;(c=getchar())!=EOF && c!='\n' && j<ROZMIAR;j++){
  23. tab[i][j]=c;
  24. }
  25. pom[i]=j;
  26. }
  27. for (i=0; i<n; i++){
  28. for (j=0; j<pom[i]; j++){
  29. printf("%c", tab[i][j]);
  30. if (j==pom[i]-1) printf("\n");
  31. }
  32. }
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement