#include using namespace std; int main() 2 4 5 E { cout « "Please enter two names \n"; string first; string second; cin >> first » second; 6 7 8 9 10 11 B 12 if (first == second) cout <« "that's the same name twice\n"; if (first < second) cout « first <« " is alphabetically before " <« second «'\n'; 13 B 14 if (first > second) <« second cout « first « " is alphabetically after <«'\n'; 15 return 0; 16

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 19PE
icon
Related questions
icon
Concept explainers
Question

 What is the output of the following code if the user enters first as John and second as john? 

            #include<string>

 

1.
#include<iostream>
using namespace std;
int main()
2
3
4
5 B {
cout « "Please enter two names \n";
string first;
string second;
cin >» first » second;
if (first
if (first < second)
6.
7.
8
9.
== second) cout <« "that's the same name twice\n";
10
11 E
12
cout « first <« " is alphabetically before " <« second
«'\n';
13 E
if (first > second)
cout « first « " is alphabetically after
«'\n';
14
<« second
15
return 0;
16
}
Transcribed Image Text:1. #include<iostream> using namespace std; int main() 2 3 4 5 B { cout « "Please enter two names \n"; string first; string second; cin >» first » second; if (first if (first < second) 6. 7. 8 9. == second) cout <« "that's the same name twice\n"; 10 11 E 12 cout « first <« " is alphabetically before " <« second «'\n'; 13 E if (first > second) cout « first « " is alphabetically after «'\n'; 14 <« second 15 return 0; 16 }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning