All about problems in Volume 4. If there is a thread about your problem, please use it. If not, create one with its number in the subject.
Moderator: Board moderators
abhi
Learning poster
Posts: 94 Joined: Fri Nov 25, 2005 7:29 pm
Post
by abhi » Wed Jan 18, 2006 5:45 pm
well i changed it to
Code: Select all
if(strlen(a[j])>column)
{
column=strlen(a[j]);
}
it works for ur input now ..... still WA
mamun
A great helper
Posts: 286 Joined: Mon Oct 03, 2005 1:54 pm
Location: Bangladesh
Contact:
Post
by mamun » Wed Jan 18, 2006 5:53 pm
change
Code: Select all
for(i=rows-1;i>=0;i--)
{
putchar(a[i][j]);
}
to
Code: Select all
for(i=rows-1;i>=0;i--)
{
if(a[i][j])
putchar(a[i][j]);
}
I know, it's kinda surprise but look at my posts at the top of this thread.
abhi
Learning poster
Posts: 94 Joined: Fri Nov 25, 2005 7:29 pm
Post
by abhi » Wed Jan 18, 2006 6:59 pm
ok this is my final code ............ i get PE
Last edited by
abhi on Sat Feb 04, 2006 3:44 am, edited 1 time in total.
mamun
A great helper
Posts: 286 Joined: Mon Oct 03, 2005 1:54 pm
Location: Bangladesh
Contact:
Post
by mamun » Wed Jan 18, 2006 7:04 pm
Well, I can't help you on PE. After many tries I got PE myself and I'm sure many got the same too.
Don't worry too much about that.
abhi
Learning poster
Posts: 94 Joined: Fri Nov 25, 2005 7:29 pm
Post
by abhi » Wed Jan 18, 2006 7:33 pm
thanks a lot to you anyways........
athlon19831
New poster
Posts: 20 Joined: Thu Jan 19, 2006 2:32 pm
Post
by athlon19831 » Thu Jan 26, 2006 8:14 am
#include<iostream.h>
#include"string.h"
#include"stdio.h"
void main(int argc, char* argv[])
{
char a[100],b[100][150];
int k=0;
int i,j,m,n;
while(gets(a))
{
strcpy(b[k],a);
k++;
}
for(j=0;;j++)
{
m=0;
for(i=k-1;i>=0;i--)
{
n=strlen(b);
if(j>=n)
continue;
else
{
cout<<b[j];
m=1;
}
}
cout<<endl;
if(m==0) break;
}
}
neno_uci
Experienced poster
Posts: 104 Joined: Sat Jan 17, 2004 12:26 pm
Location: Cuba
Post
by neno_uci » Thu Jan 26, 2006 4:25 pm
Your program prints an extra line after the output, try to avoid this and you will get AC, good luck,
Yandry.
tmdrbs6584
Learning poster
Posts: 98 Joined: Sat Jan 21, 2006 12:45 pm
Location: Busan,Corea(Republic of)
Post
by tmdrbs6584 » Sun Feb 12, 2006 11:20 am
#include<iostream.h>
#include<string.h>
char a[101][101];
int main(){
int i,j;
int sw=0;
while(cin.getline(a[sw],101))
sw++;
int max=0;
for(i=0;i<sw;i++){
if(strlen(a
)>max)
max=strlen(a);
}
for(i=0;i<max;i++){
for(j=sw-1;j>=0;j--){
cout << a[j];
}
cout << endl;
}
return 0;
}
WHY WA??
Wei-Ming Chen
Experienced poster
Posts: 122 Joined: Sun Nov 13, 2005 10:25 am
Location: Taiwan
Post
by Wei-Ming Chen » Sun Feb 12, 2006 3:16 pm
try this:
change your code to
if(a[j][i])
{
cout << a[j][i];
}
Psyco
New poster
Posts: 14 Joined: Sat Jan 21, 2006 12:39 pm
Contact:
Post
by Psyco » Tue Feb 21, 2006 2:28 pm
I think too, Huh?
sakhassan
Experienced poster
Posts: 105 Joined: Sat Mar 11, 2006 9:42 am
Location: cse,DU
Post
by sakhassan » Sat Mar 11, 2006 11:05 am
Deleted..........
What the problem with this code???
Last edited by
sakhassan on Sun Mar 12, 2006 8:52 am, edited 1 time in total.
Artikali
Learning poster
Posts: 68 Joined: Wed Sep 21, 2005 5:27 pm
Post
by Artikali » Sat Mar 11, 2006 4:03 pm
i think you did not initialize table
sakhassan
Experienced poster
Posts: 105 Joined: Sat Mar 11, 2006 9:42 am
Location: cse,DU
Post
by sakhassan » Sun Mar 12, 2006 8:50 am
Thanks .... Got AC...
fayyazkl
New poster
Posts: 11 Joined: Thu Mar 16, 2006 8:02 am
Location: Lahore, Pakistan
Post
by fayyazkl » Mon Apr 03, 2006 9:22 am
I have checked all inputs available on the board. Here is my code. Please help a little!! I shall be really grateful
# include <iostream>
using namespace std;
main ()
{
char rot[101][101];
char trans[101][101];
int i=0,k, rows=0;
for (int p=0; p<101; p++) // fill whole array with spaces
for (int q=0; q<101; q++)
trans[p][q]=' ';
while (cin.getline(rot[i++],100)); // take input
for (int j=i-2,col=0; j>=0;j--,col++) // copy into transpose
{ // from right to left
for (k=0; rot[j][k]!='\0' ; k++)
trans[k][col] = rot[j][k];
if (rows<k)
rows=k;
}
int d;
for (int c=0; c<rows; c++) // mark end of each row
{
for (d=100; d>=0;d--)
if (trans[c][d]!=' ')
break;
trans[c][d+1]='\0';
}
for (int t=0; t<rows;t++) // printing the transpose
cout << trans[t] << endl;
return 0;
}
Ankur Jaiswal
New poster
Posts: 31 Joined: Sat Apr 01, 2006 6:24 am
Contact:
Post
by Ankur Jaiswal » Sun May 07, 2006 6:26 pm
hi,
check this input :
my name is ankur jaiswal.
i know many people by the name of ankur.
hello people.
Your program gave following output :
him
e y
lk
lnn
ooa
wm
p e
em
oai
pns
ly
e a
.pn
ek
ou
pr
l
ej
a
bi
ys
w
ta
hl
e.
n
a
m
e
o
f
a
n
k
u
r
.
i.e. your program does not print spaces at the end. I think this is your mistake.