The full structure of a C++ program to compare two strings and check whether they are equal

Recommended Answers

All 3 Replies

#include    <stdio.h>
#include    <string.h>
void    main()
{
  char s1[]="abcd",s2[]="xyz";

  if(strcmp(s1,s2))
    printf("No");
  else
    printf("Yes");
}

You could use google/your course book for such a question, since its answer is almost trivial.

#include <string>

bool cmp(string a, string b){
    return a == b;
}

Also, have a look at this:
Click Here

Yes SIR! At your command SIR!
Is is too difficult for people from Dar Es Salaam to pose a question in a more friendly manner?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.