Question #310824

6. Write a C++ program that take two string as input from user and check if both strings are same or not. If same, print YES, otherwise print NO.

Expert's answer

#include <iostream>
#include <string>
using namespace std;

int main()
{
    string s1, s2;
    getline(cin, s1);
    getline(cin, s2);
    if (s1==s2) cout<<"YES";
    else cout<<"NO";
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS