hello..
i have kined of noobie question..
if i have a string : "a,f,b,k,e"
and i want to convert it, so it will look like this : "e,k,b,f,a".
how can i do it??
(i think i have to move them to the right or left 5 times).
Basically i need to create a program that get an arry from the user and it shouldnt be more that 50 chars.
then do what i showed you above.
i tryed to make an other arry and do like this:
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
|
#include <iostream>
using namespace std;
int main ()
{
int i,j,a;
char one[a],two[a];// dont shore this is correct.
do
{
cout<<"enter char less than 50.\n";
cin>>one[a];
}
while (a>50);
// i dont know how to set the valu of "a" !
// it should be the number of the chars in the arry.
// depends on what the user enter.
for (j=0;j<a;j++)
{
for (i=0;i<a;i++)
{
two[i+1]=one[i];
}
two[0]=one[a];
}
cout<<"now you got "<<two[a]<<endl;
system ("PAUSE");
return 0;
}
|
but it didn't work.
hlp me pls :)
~~~~~~~~~~~~~~~~~~~~~
Edit : ohhh i got a terible mistake! i cant do this by moving them 50 times to the right cuz its geting back to where it starts..
so i still need your help.. :D