Advertisement
brookdale

Untitled

Dec 18th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. char S[200];
  8. char c = ',';
  9. int o = 0;
  10. int t = o;
  11. int x = 0, y = 0;
  12. char word[20][200];
  13. cin.getline(S, 200);
  14. while (S[o]) {
  15. if (S[o] != c)
  16. S[t++] = S[o];
  17. o++;
  18. }
  19. for (int i = 0; i < strlen(S); i++) {
  20. if (S[i] == ' ') {
  21. if (x < 20) {
  22. int p = x;
  23. while (p < 20) {
  24. word[p][y] = ' ';
  25. p++;
  26. }
  27. }
  28. y++;
  29. x = 0;
  30. }
  31. else {
  32. word[x][y] = S[i];
  33. x++;
  34. }
  35. }
  36. while (x < 20) {
  37. word[x][y] = ' ';
  38. x++;
  39. }
  40. y++;
  41. if (y < 20) {
  42. for (y = y; y < 20; y++) {
  43. for (x = 0; x < 20; x++) {
  44. word[x][y] = ' ';
  45. }
  46. }
  47. }
  48. for (int j = 0; j < 20; j++)
  49. {
  50. for (int i = 0; i < 20; i++)
  51. {
  52. printf("%c ", word[i][j]);
  53. };
  54. printf("\n");
  55. }
  56. system("pause");
  57. return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement