Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main() {
- char S[200];
- char c = ',';
- int o = 0;
- int t = o;
- int x = 0, y = 0;
- char word[20][200];
- cin.getline(S, 200);
- while (S[o]) {
- if (S[o] != c)
- S[t++] = S[o];
- o++;
- }
- for (int i = 0; i < strlen(S); i++) {
- if (S[i] == ' ') {
- if (x < 20) {
- int p = x;
- while (p < 20) {
- word[p][y] = ' ';
- p++;
- }
- }
- y++;
- x = 0;
- }
- else {
- word[x][y] = S[i];
- x++;
- }
- }
- while (x < 20) {
- word[x][y] = ' ';
- x++;
- }
- y++;
- if (y < 20) {
- for (y = y; y < 20; y++) {
- for (x = 0; x < 20; x++) {
- word[x][y] = ' ';
- }
- }
- }
- for (int j = 0; j < 20; j++)
- {
- for (int i = 0; i < 20; i++)
- {
- printf("%c ", word[i][j]);
- };
- printf("\n");
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement