-
Programming exercise for beginners I
Requires knowledge of: functions
Write a function taking 5 int arguments and returning a bool.
Code:
bool are_sides_and_diagonal( int a, int b, int c, int d, int e ) ;
The five arguments are the lengths of five straight line segments.
The function should return true if it is possible to form a quadrilateral of which the sides are any four of the arguments and the remaining one argument is a diagonal. Otherwise, it should return false.
Example: With the arguments 1, 2, 3, 4, 5 no such quadrilateral can be formed. Return false.
Example: With the arguments 2, 3, 4, 5, 6 such a quadrilateral can be formed (with sides 2,3,5,6 and 4 as a diagonal). Return true.
Similar Threads
-
By BananaPeal in forum C++
Replies: 5
Last Post: 04-24-2009, 09:05 AM
-
By Kallahan in forum Java
Replies: 1
Last Post: 01-20-2003, 09:28 AM
-
By Novosoft in forum web.announcements
Replies: 0
Last Post: 02-14-2001, 04:50 AM
-
By Philip King in forum authorevents.appleman
Replies: 1
Last Post: 04-10-2000, 12:27 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|