Reverse a String C++

This program reverses a given string.

#include <iostream>

#include <string>

 

int main() {

    std::string str;

    std::cout << "Enter a string: ";

    std::cin >> str;

 

    std::string reversedStr = std::string(str.rbegin(), str.rend());

    std::cout << "Reversed string: " << reversedStr << std::endl;

 

    return 0;

}

No comments:

Post a Comment

MS Excel Logical Functions

Logical functions in Excel are powerful tools that help you make decisions based on conditions. Whether you're comparing values or testi...

Post Count

Loading...