Code:
//Bryan Wertz II
//March 8th, 2006
//Intermediate C++, Terminal 1.
//Cube Program
#include <graphics.h> //Header file.
#include <conio.h> //Header file.
#include <iostream.h> //Header file.
#include <fstream.h> //Header file.
void Cube_Printer() //function that prints a cube on the screen.
{
int graphdriver=DETECT,graphmode; //Goes into Graphics mode.
initgraph(&graphdriver,&graphmode,"c:..\\bgi");
moveto(120,130);
lineto(150,110);
lineto(210,110);
lineto(180,130);
lineto(120,130);
moveto(120,170);
lineto(180,170);
lineto(210,150);
lineto(210,110);
moveto(120,170);
lineto(120,130);
moveto(180,170);
lineto(180,130);
moveto(210,150);
lineto(150,150);
lineto(120,170);
moveto(150,150);
lineto(150,110);
setbkcolor(1);
setlinestyle(0,0,3);
setcolor(3);
rectangle(120,130,180,170);
moveto(120,130);
lineto(150,110);
lineto(210,110);
lineto(180,130);
moveto(210,110);
lineto(210,150);
lineto(180,170);
setlinestyle(1,0,3);
setcolor(3);
moveto(150,110);
lineto(150,150);
lineto(120,170);
moveto(150,150);
lineto(210,150);
moveto(300,300);
outtext("Press any key to end.");
getch();
closegraph(); //closes graph.
}
int main()
{
cout << "This is going to print a cube onto the screen.\n\n\n";
cout << " Press any key to continue!";
getch();
Cube_Printer(); //call to Cube_Printer.
return 0; //end of program.
}