1 #include <iostream>
2 using namespace;
3 /* This program indicates if a triangle is a
4 valid triangle or not. A triangle is a
5 valid triangle, if the sum of any of it’s
6 two sides is greater than the third one.
7 /*
8 int read_numbers(double& , double& , double& );
9 bool triangle (double a, double b);
10 void read_numbers(double& x, double& y, double& z)
11 {
12 cout << "\nEnter the first number: ";
13 cin >> x;
14 cout << "\nEnter the first number: ";
15 cin >> y;
16 cout << "\nEnter the first number: ";
17 cin << z;
18 }
19 int main()
20 {
21 double x, y = 0 , z;
22 bool true_or_false;
23 read_numbers(x, y);
24 If(!x || !y || !z)
25 cout << "Invalid input.";
26 else if(triangle(x, y, z))
27 cout << "this a valid triangle.";
28 else
29 cin << "this is not a valid triangle. ";
30 return;
31 }
32 bool triangle (double x, double y, double z)
33 {
34 if ( x + y > z && x + z > y && z + y > x)
35 return true
36 }
There are ten compiler errors. can you someone help me with them. thanks.. i have found 7 of them. will rate lifesaver.. need to study for exam.
Line 2: std is missing
Line 10: void should be int
Line 17: Should be cin >> z
Line 24: “If” should be “if”
Line 29: cin should be cout
Line 30: Should be return 0;
Line 35: Needs semicolon