Write a C++ program to print strings in reverse order.



Write a C++ program to print strings in reverse order...

Answer / Omprakash Varanwal

Here is a simple C++ program that prints a string in reverse order: ```n
#include <iostream>n
#include <string>n
n
int main() {n
std::string str = "Hello, World!";n
for (int i = str.length(); i >= 0; --i) {n
std::cout << str[i];n
}n
return 0;n
}".

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ Interview Questions

Execute the qsort () in c/sort() in c++ library or your own custom sort which will sort any type of data on user defined criteria.

1 Answers   Adobe,


What is a virtual function in C++?

1 Answers   C DAC,


Write a program to input an integer from the keyboard and display on the screen “WELL DONE” that many times.

1 Answers  


How does stack look in function calls? Write a recursive function call, how will the stack look like?

1 Answers   Adobe,


How to invoke a C function using a C++ program?

1 Answers   Alter,


Define an Abstract class in C++?

1 Answers  


What are the advantages/disadvantages of using #define?

1 Answers   Amazon,


Explain why C++ is not purely Object Oriented Language

1 Answers   Aspire,


Identify the error in the following program. include<iostream> using namespace std; void main() { int num[]={1,2,3,4,5,6}; num[1]==[1]num ? cout<<"Success" : cout<<"Error"; }

1 Answers  


When would you use a pointer? A reference?

1 Answers   Amazon,


Declare a pointer to a function that takes a char pointer as argument and returns a void pointer.

1 Answers   Alter,


What does malloc return in C and C++?

1 Answers   Alter,


Categories