Write your question here.
INPUT / OUTPUT
As input to my program, I will be given a maximum of 15 sentences, each not
exceeding 100 characters long. Legal characters include: newline, space, any
punctuation characters, digits, and lower case or upper case English letters. The input
file starts with an integer indicating the number of lines that the input file contains.
The output of the program should have the last sentence printed out vertically in the
leftmost column; the first sentence of the input would subsequently end up at the
rightmost column.
Sample Input (rotate.txt)
2
Rene Decartes once said,
"I think, therefore I am."
Sample Output
"R
Ie
n
te
h
iD
ne
kc
,a
r
tt
he
es
r
eo
fn
oc
re
e
s
Ia
i
ad
m,
.
"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
here's m code can someone help me deal with these?
coz it still prints the case number for my program
#include<iostream>
#include<string.h>
#include<fstream>
using namespace std;
int main()
{
freopen("Rotation.txt","r",stdin);
int i,j,len,maxlen,k;
char s[100][100];
i=0;
maxlen=0;
memset(s,0,sizeof(s));
while (gets(s[i]))
{
len=strlen(s[i]);
if (len>maxlen)
maxlen=len;
i++;
}
for (j=0;j<maxlen;j++)
{
for (k=i;k>=0;k--)
{
if (s[k][j]==0)
cout<<" ";
else
cout<<s[k][j];
}
cout<<"\n";
}
return 0;
}
|