home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Clip Art Extravaganza: Business & Home 2
/
CSB2.ISO
/
clip2
/
program2
/
hgrph101.arc
/
COP.C
< prev
next >
Wrap
C/C++ Source or Header
|
1989-02-25
|
2KB
|
59 lines
/* CORNUCOPIA -- see article on "pseudo-hidden line removal" */
/* IBM-PC Exchange, May-June 1986 */
#include <math.h>
#include <conio.h>
#include "hgraph.h"
main()
{
int d, a0, b0, a1, b1, a, b;
double r, rada, radb;
hgraph_init();
hgmode_nc();
hclearpg();
hshowpg();
hstr(40, 1, " CORNUCOPIA ", 0xff, 12);
for (d = 1; d <= 100; ++d)
{
rada = (float)d;
radb = 0.65 * rada;
a0 = 20 + 4 * d;
b0 = 20 + 2 * d + (int)(radb * 0.6 * sin(d/10.0));
hline(0, a0, b0, a1 = a0, b1 = b0 + (int)radb);
for (r = 0.0; r < 6.3; r += 6.28/40.0)
{
a = a0 + (int)(rada * sin(r));
b = b0 + (int)(radb * cos(r));
hline(1, a1, b1, a, b);
hline(0, a0, b0, a1 = a, b1 = b);
}
}
/* This next section flips back and forth from
* text to graphics three time to show the use of the
* non-clearing hgmode_nc & htmode_nc the user must hit a
* key to cause the flip
*/
hstr(10, 40, "Press any key to continue ... ", 0x00, 30);
getch();
htmode_nc();
puts("Press any key to continue ... ");
getch();
hgmode_nc(); hshowpg();
getch();
htmode_nc();
getch();
hgmode_nc(); hshowpg();
getch();
htmode(); /* this will clear the text screen */
}