0
Plz give me the code to reverse a string of integers and store the reversed string in another array.thanks un advance.
2 ответов
0
#include<iostream>
#include<cstdlib>
#include<iomanip>
using namespace std;
int main()
{
char a[100],b[100];
int len=0;
char temp;
cout<<"Enter the integer string"<<endl;
getline(cin,a); //retrieving input integer
while(a[len] != '\0')
len++; // gets total length of string
for(int i=0;i=len/2;i++) // reversing string
{
temp=a[i];
a[i]= a[len-i];
a[len-i]=temp;
}
for(int i=0;i=len;i++) // copying string
{
b[i]=a[i];
}
return 0;
}
0
i tried this code .actually the string what I'm saying is of integers and this code is not working for that,even after declaring a and b arrays as int. thanks