Simple Do-Loop Help on C++

timer Asked: Sep 23rd, 2015

Question description

This is not a hard question, but I'm having trouble. Should only need a little bit of code. Please follow instructions below. To check if the 3 sides form a triangle use : ((A + B) > (C) && (B + C) > (A) && (C + A) > B)

Use variables A, B, and C for the 3 triangle sides. I am confused most on how to get it to loop to the first step. Feel free to use any type of loop you want, but I believe a while or do-while would be best


In this assignment, you will ask the user to enter three real value measurements for their triangle, and store them in some variables. Then, continue to ask the user for their measurements until they are valid (i.e., all measurements > 0 and measurements form a triangle). Here is pseudocode for your  program:

  1. Ask user to enter three sides for a triangle
  2. Read their input
  3. If any measurement is <0, go to step 1
  4. If the measurements do not form a triangle, go to step 1
  5. Print "Woohoo - input is valid" and exit program

Tutor Answer

(Top Tutor) Studypool Tutor
School: UC Berkeley
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors