🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #12165

Re: help with c algorithm

#12165
From: Lennart Yseboodt
Date: Tue, 27 Nov 2001 16:32
90 lines
3897 bytes
Please do ure homework ureself.
"h.k." <shiri7@inter.net.il> wrote in message
news:9turb4$c8b$1@news.inter.net.il...
> hello every one!
>
> please help me with a  c  program.
> the program is attached to this message.
> notice : Its not so easy : this program must NOT include pointers,
> structures, libraries(conio.h,...), etc... , but should include arrays and
> 5 function as say in the file attached.
>
> thank u very much.
>
>                                                     h.k.
>
>
>
>  This  is a infinite equilateral Triangle of points:
>
>
>
>
>
>
>
>
>
>
>
>
> Note that if we number the points from left to right and top to bottom,
then
> groups of these points form the vertices of certain geometric shapes. For
> example, the sets of points {1,2,3} and {7,9,18} are the vertices of
> triangles, the sets {11,13,26,24} and {2,7,9,18} are the vertices of
> parallelograms, and the sets {4,5,9,13,12,7} and {8,10,17,21,32,34} are
the
> vertices of hexagons.
>
> Write a program which will repeatedly accept a set of points on this
> triangular grid, analyze it, and determine whether the points are the
> vertices of one of the following "acceptable" figures: triangle,
> parallelogram, or hexagon. In order for a figure to be acceptable, it must
> meet the following two conditions:
>
>   1.. Each side of the figure must coincide with an edge in the grid.
>   2.. All sides of the figure must be of the same length.
> Input and Output
> The input will consist of an unknown number of lines of unknown number of
> point sets.
> .There are at most six points in a set and the points are limited to the
> range 1..32767.
>
> For each point set in the input file, your program should deduce from the
> number of points in the set which geometric figure the set potentially
> represents; e.g., six points can only represent a hexagon, etc. The output
> must be a series of lines listing each point set followed by the results
of
> your analysis.
> To end the program the user will enter an empty line.
>
>  Sample Input - Output
> 1 2 3
> 1 2 3 are the vertices of a triangle
> 11 13 29 31
> 11 13 29 31 are not the vertices of an acceptable figure
> 26 11 13 24
> 26 11 13 24 are the vertices of a parallelogram
> 4 5 9 13 12 7
> 4 5 9 13 12 7 are the vertices of a hexagon
> 1 2 3 4 5
> 1 2 3 4 5 are not the vertices of an acceptable figure
> 47
> 47 are not the vertices of an acceptable figure
> 11 13 23 25
> 11 13 23 25 are not the vertices of an acceptable figure
> <cr>
>               Important notes:
>
>   a.. The program must include at least 5 functions:
>     a.. function  for inputs
>     b.. function that translates points numbers to a two-dimensional array
> of x-y coordinates
>     c.. 3 functions that check for each figure if the points define one
> these figures.
>   a..
>
>
>
>
Technical Details
Message-ID: <3c03bff7$0$14654$ba620e4c@news.skynet.be>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.icl.net!newsfeeds.belnet.be!news.belnet.be!ossa.telenet-ops.be!skynet.be!skynet.be!louie!not-for-mail
References: <9turb4$c8b$1@news.inter.net.il>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fcea4,ff1444a4b158033b,start
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2001-11-27 08:32:09 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.icl.net!newsfeeds.belnet.be!news.belnet.be!ossa.telenet-ops.be!skynet.be!skynet.be!louie!not-for-mail
From: "Lennart Yseboodt" <lennartyseboodt@skynet.be>
Newsgroups: be.comp.programming
References: <9turb4$c8b$1@news.inter.net.il>
Subject: Re: help with c algorithm
Date: Tue, 27 Nov 2001 17:32:11 +0100
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Lines: 92
Message-ID: <3c03bff7$0$14654$ba620e4c@news.skynet.be>
Organization: -= Skynet Usenet Service =-
NNTP-Posting-Host: 217.136.146.46
X-Trace: 1006878711 reader1.news.skynet.be 14654 217.136.146.46
X-Complaints-To: abuse@skynet.be