Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- char a[11][501][101];
- int v[11],n,m;
- void Cuvinte(char s[], int l)
- {
- int c=0;
- char *p;
- p=strtok(s," ");
- while(p)
- {
- c++;
- strcpy(a[l][c],p);
- p=strtok(0," ");
- }
- v[l]=c;
- if(c>m)m=c;
- }
- void Citire()
- {
- cin>>n;cin.get();
- char s[1001];
- for(int i=1;i<=n;i++)
- {
- cin.getline(s,1001);
- Cuvinte(s,i);
- }
- }
- void Afisare()
- {
- for(int j=1;j<=m;j++)
- for(int i=1;i<=n;i++)
- if(strlen(a[i][j])!=0) cout<<a[i][j]<<' ';
- }
- int main()
- {
- Citire();
- Afisare();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement