Using the STL generic reverse algorithm with a string and assert the correctness : assert « Development « C++ Tutorial






#include <iostream>
#include <string>
#include <cassert> 
#include <algorithm> // For reverse algorithm
using namespace std;

int main()
{
  string string1 = "abc";
  reverse(string1.begin(), string1.end());
  assert (string1 == "cba");
  

  return 0;
}








5.29.assert
5.29.1.Use assert inside a for loop to check an array
5.29.2.Using the STL generic reverse algorithm with a string and assert the correctness
5.29.3.Use assert to check