Page 4 of 15

Posted: Wed Jan 18, 2006 5:45 pm
by abhi
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

Posted: Wed Jan 18, 2006 5:53 pm
by mamun
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.

Posted: Wed Jan 18, 2006 6:59 pm
by abhi
ok this is my final code ............ i get PE

Code: Select all

DELETED AFTER PE  :wink: 

Posted: Wed Jan 18, 2006 7:04 pm
by mamun
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.

Posted: Wed Jan 18, 2006 7:33 pm
by abhi
thanks a lot to you anyways........ :D

490 Presentation Error

Posted: Thu Jan 26, 2006 8:14 am
by athlon19831
#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;

}


}

Posted: Thu Jan 26, 2006 4:25 pm
by neno_uci
Your program prints an extra line after the output, try to avoid this and you will get AC, good luck,

Yandry. :D

490 WHY WA?

Posted: Sun Feb 12, 2006 11:20 am
by tmdrbs6584
#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?? :oops: :oops: :oops:

Posted: Sun Feb 12, 2006 3:16 pm
by Wei-Ming Chen
try this:

change your code to

if(a[j][i])
{
cout << a[j][i];
}

Umm...

Posted: Tue Feb 21, 2006 2:28 pm
by Psyco
I think too, Huh?

WA.....490

Posted: Sat Mar 11, 2006 11:05 am
by sakhassan
Deleted..........
What the problem with this code???

Posted: Sat Mar 11, 2006 4:03 pm
by Artikali
i think you did not initialize table

Re: WA.....490

Posted: Sun Mar 12, 2006 8:50 am
by sakhassan
Thanks .... Got AC... :P

490 please help WA

Posted: Mon Apr 03, 2006 9:22 am
by fayyazkl
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;
}

Posted: Sun May 07, 2006 6:26 pm
by Ankur Jaiswal
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.