77 964
Assignments Done
Successfully Done
In August 2019

Answer to Question #20173 in C++ for apoorva

Question #20173
Write a program to reverse a string
(i)using another array
(ii)without another array
Expert's answer

#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <string.h>

void main()

int str[50], rev[50];

cout<< "
Enter a string :";
int l = strlen(str);

/* Reverse String using another array */
for( int i = l-1, k = 0 ; i>= 0 ; i--, k++)
rev[k] = str[i];

cout<< "
Original String is "<< str;
cout<< "
Reverse String is "<< rev ;
cout<< "
Reverse String is ";

/* Reverse String without using another array */
for( i = l-1 ; i>=0 ; i--)
cout<< str[i];



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions