Q:

Write a program that uses a do while loop to repetitively request two strings from the user and report which string is less than the other

0

Write a program that uses a do while loop to repetitively request two strings from the user and report which string is less than the other.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>
#include <string>

int main() {
  std::string s1, s2;
  std::cin >> s1 >> s2;
  do {
    std::cout << ( s1 == s2 ? "Equal"
                            : s1 < s2 ? "First small" : "Second small")
              << std::endl;
  } while (std::cin >> s1 >> s2);

  return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now