Monday, August 18, 2008

CPP GRAPICS




// diction.cpp: Implementation of the Dictionary class
// from Hands-on C++
#include "diction.h"

int Dictionary::find_word(char *s)
{
char word[81];
for (int i = 0; i < nw =" 0;" word_idx =" find_word(word);">= 0)
{
while (words[word_idx].get_meaning(nw,meaning) != 0)
{
def[nw] = new char[strlen(meaning)+1];
strcpy(def[nw++],meaning);
}
def[nw] = 0;
}

return nw;
}



// diction.h: The Dictionary class
// from Hands-on C++
#include "def.h"

const int Maxwords = 100;

class Dictionary
{
Definition *words; // An array of definitions; line 9
int nwords;

int find_word(char *); // line 12

public:
// The constructor is on the next line
Dictionary(int n = Maxwords) {nwords = 0; words = new Definition[n];};
~Dictionary() {delete words;}; // This is the destructor
void add_def(char *s, char **def);
int get_def(char *, char **);
};


// stack.cpp: Implementation of the Stack class
// from Hands-on C++
#include
#include "stack.h"

int Stack::push(int elem)
{
int m = getmax();
if (top <> 0)
{
get_elem(elem,--top);
return 0;
}
else
return -1;
}

void Stack::print()
{
int elem;

for (int i = top-1; i >= 0; --i)
{ // Print in LIFO order
get_elem(elem,i);
cout <<>// Graphics library declarations
#include "point.h" // Location and Point class declarations
#include // for string functions
#include // for console I/O

// link with point2.obj and graphics.lib

// The class hierarchy:
// Location->Point->Circle
// (Circle and CMessage)->MCircle

class Circle : public Point { // Derived from class Point and
// ultimately from class Location
protected:
int Radius;
public:
Circle(int InitX, int InitY, int InitRadius);
void Show(void);
};


class GMessage : public Location {
// display a message on graphics screen
char *msg; // message to be displayed
int Font; // BGI font to use
int Field; // size of field for text scaling

public:
// Initialize message
GMessage(int msgX, int msgY, int MsgFont, int FieldSize,
char *text);
void Show(void); // show message
};


class MCircle : Circle, GMessage { // inherits from both classes
public:
MCircle(int mcircX, int mcircY, int mcircRadius, int Font,
char *msg);
void Show(void); // show circle with message
};


// Member functions for Circle class

//Circle constructor
Circle::Circle(int InitX, int InitY, int InitRadius) :
Point (InitX, InitY) // initialize inherited members
//also invokes Location constructor
{
Radius = InitRadius;
};

void Circle::Show(void)
{
Visible = true;
circle(X, Y, Radius); // draw the circle
}

// Member functions for GMessage class

//GMessage constructor
GMessage::GMessage(int msgX, int msgY, int MsgFont,
int FieldSize, char *text) :
Location(msgX, msgY)
//X and Y coordinates for centering message
{
Font = MsgFont; // standard fonts defined in graph.h
Field = FieldSize; // width of area in which to fit text
msg = text; // point at message
};

void GMessage::Show(void)
{
int size = Field / (8 * strlen(msg)); // 8 pixels per char.
settextjustify(CENTER_TEXT, CENTER_TEXT); // centers in circle
settextstyle(Font, HORIZ_DIR, size); // magnify if size > 1
outtextxy(X, Y, msg); // display the text
}

//Member functions for MCircle class

//MCircle constructor
MCircle::MCircle(int mcircX, int mcircY, int mcircRadius, int Font,
char *msg) : Circle (mcircX, mcircY, mcircRadius),
GMessage(mcircX,mcircY,Font,2*mcircRadius,msg)
{
}

void MCircle::Show(void)
{
Circle::Show();
GMessage::Show();
}

main() //draws some circles with text
{
int graphdriver = DETECT, graphmode;
initgraph(&graphdriver, &graphmode, "..\\bgi");
MCircle Small(250, 100, 25, SANS_SERIF_FONT, "You");
Small.Show();
MCircle Medium(250, 150, 100, TRIPLEX_FONT, "World");
Medium.Show();
MCircle Large(250, 250, 225, GOTHIC_FONT, "Universe");
Large.Show();
getch();
closegraph();
return 0;
}

// figures.h contains three classes.
//
// Class Location describes screen locations in X and Y
// coordinates.
//
// Class Point describes whether a point is hidden or visible.
//
// Class Circle describes the radius of a circle around a point.
//
// To use this module, put #include in your main
// source file and compile the source file FIGURES.CPP together
// with your main source file.

enum Boolean {false, true};

class Location {
protected:
int X;
int Y;
public:
Location(int InitX, int InitY) {X = InitX; Y = InitY;}
int GetX() {return X;}
int GetY() {return Y;}
};

class Point : public Location {
protected:
Boolean Visible;
public:
Point(int InitX, int InitY);
virtual void Show(); // Show and Hide are virtual
virtual void Hide();
virtual void Drag(int DragBy); // new virtual drag function
Boolean IsVisible() {return Visible;}
void MoveTo(int NewX, int NewY);
};

class Circle : public Point { // Derived from class Point and
// ultimately from class Location
protected:
int Radius;
public:
Circle(int InitX, int InitY, int InitRadius);
void Show();
void Hide();
void Expand(int ExpandBy);
void Contract(int ContractBy);
};

// prototype of general-purpose, non-member function
// defined in FIGURES.CPP

Boolean GetDelta(int& DeltaX, int& DeltaY);




Windows Mobile 6 Announced, Released Soon





Windows Mobile 6, formerly known as Crossbow has been announced, and should start appearing on phones mid to late this year! Microsoft has been pretty quiet about this one all along, but even a year ago, people were able to get a glimpse into what Microsoft had brewing with a very pre-mature leaked version. More recently, Screenshots became available which gave us a better idea of what Microsoft was planning.
The Windows Mobile Team is ready to officially reveal Windows Mobile 6 next week at the 3GSM show in Barcelona. A lot of great features are instore with a focus on improved searching, better security (sound like Vista?), and better integration with Windows Live Services. While the majority of products that will use the operating system won’t be released until later this year, Mobile 6 is expected sometime in the 2nd quarter 2007.




Features include:
HTML Support in email
Windows Live for Windows Mobile
New versions of mobile with better formatting for Outlook, Word, Excel, and PowerPoint
New Security features like remote wipe if the device is lost or stolen
Vista integration
Calendar ribbon
Call history in contact cards
NET Compact Framework and SQL Server built-in
Smartphones will use Windows Mobile 6 “Standard”, Pocket PC’s without the phone will use Windows Mobile 6 “Classic”, and Pocket PC Phones will use Windows Mobile 6 “Professional.”
With all of the improvements, and a new look and feel, it just might be worth the upgrade.



Source: The Hive



No comments:

YouTube Top Videos

table border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px; border:1px solid #000000;">Gadget by LabPixies.com

MY Times Classic Crossword

Lucky numbers