60 578
Assignments Done
97,9%
Successfully Done
In April 2018

Answer to Question #3316 in C++ for mukunda

Question #3316
Write a program to compare two strings
Expert's answer
#include <iostream>
#include <string>
using namespace std;

int main()
{
string str1 = "hello", str2 = "world";
if (str1 < str2)
cout << str1 << " is less than " << str2 << endl;
else if (str1 > str2)
cout << str1 << " is greater than " << str2 << endl;
else
cout << str1 << " is equal to " << str2 << endl;

return 0;
}

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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions