Reverse of a number in C++

Source code :

#include <iostream>
#include <string.h>
using namespace std;
int main()
{
   char a[]="apple",b[]="app";
    
    if (strcmp(a,b) == 0)
      cout<<"Entered strings are equal.\n";
   else
      cout<<"Entered strings are not equal.\n";
 
   return 0;
}

Output :

Entered strings are not equal.

Algorithm :

  1. Initialize the char values
  2. Use the strcmp function to compare the strings
  3. Finally print the result

Output :


                

Comments :