for what we have done in class so far we have only used #include <iostream> <fstream> <cmath> <string> <iomanip>, so if possible if this can be done using that so I can understand for my next assignment that would be great thanks!
Question: In a triangle, the sum of the lengths of any two sides is greater than the length of the other third side. Write a program triangle.cc that prompts a user to enter the lengths of three sides, check if they form a triangle, and outputs if it is an isosceles, equilateral, scalene,
or right triangle. In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other two sides. An isosceles triangle has two sides of equal length. An equilateral triangle has all three sides with the same length. A scalene triangle has no equal sides.
Test Run 1:
Enter the lengths of the three sides of a triangle -- 12.5 16.2 12.5
This is an isosceles triangle
Test Run 2:
Enter the lengths of the three sides of a triangle -- 3 5 4
This is a scalene and right triangle
Test Run 3:
Enter the lengths of the three sides of a triangle -- 4 1 2
This is not a triangle
Test Run 4:
Enter the lengths of the three sides of a triangle -- 1 1.4142 1
This is an isosceles and right triangle
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images
- Consider the following code segment. It is designed to identify the first location within a string, text where two adjacent characters are the same. i = 1 found = False while not found and i < len (text) : found = True else : i = i + 1 What line of code should be placed in the blank to achieve this goal? O a. if text[i] == text[i] : O b. if text[i] text[i 1] : 3%3D %3D O c. if text[i] == text[0] : O d. if text[i] == text[i + 1] :arrow_forwardAssume a given email is valid. Write a program which extracts the username and domain from a valid email address using string::find and string::substr methods. Sample output: Type your valid email: eyildirim@qcc.cuny.edu Username: eyildirim Domain: qcc.cuny.edu C++ #include <iostream>#include <string>using namespace stdarrow_forwardWrite a program that prompts a user to enter a year between 1 and 2499 and prints its century in the format such as 1st, 2nd, 3rd, 4th, etc. please use a switch statement. for what we have done in class so far we have only used #include <iostream> <fstream> <cmath> <string> <iomanip>, so if possible if this can be done using that so I can understand for my next assignment that would be great thanks! Test Run 1:Enter a year between 1 and 2499 -- 19231923 is in the 20th century Test Run 2:Enter a year between 1 and 2499 -- 22022202 is in the 23rd century Test Run 3:Enter a year between 1 and 2499 -- 2630Wrong year!arrow_forward
- Given string userInput on one line and string endString on a second line, assign concatStr with the copy of userInput with endString appended. Ex: If the input is: Fuzzy bear !!! then the output is: Fuzzy bear!!! #include <iostream> #include <string> using namespace std; int main() { string userInput; string endString; string concatStr; getline(cin, userInput); getline(cin, endString); /* Your code goes here */ cout << concatStr << endl; return 0; }arrow_forward1. '\0' is used in a c string to : a. show the start of a c string b. show where a c string ends for functions that use the c string c. the total number of bytes allocated for the cstring d. show the length of a c string 2. A structure is basically the same as a class with the main difference being a default public protection level. a. true b. falsearrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education