f4game

Sunday, November 9, 2008

Examble for my test

Introduction:
The PreProcessor directive #define , can be used to define formulas to simplify the structure of a program,
In some cases, we can use preprocessor macros instead of functions to do mathematical calculations.
This assignment will help you to better understand functions and #define statements.
1. Type in the following program that computes the AREA of a TRIANGLE and save it as
ASSIGN3A
The #define statement at the top of the program defines the formula for computing the area of a triangle.
Other forms of using #define to calculate the area of a triangle with TWO INPUT PARAMETERS:
#define area(x,y) 0.5 * (x) * (y)
#define tri_area(base,height) 0.5 * (base) * (height)

/*
Title: Triangle Area Calculation Program - using a #define
Author: YOUR NAME HERE
Date: CURRENT DATE HERE
Description: The user is asked to type in the BASE
and HEIGHT of a TRIANGE, and the program
will output the HEIGHT, BASE and AREA
of the TRIANGLE.
*/
// INCLUDE SECTION
#include // used for printf, scanf, getchar, puts
#include // used for getch
#include // used for system
// DEFINE SECTION
#define area_tri(b,h) (1.0/2.0)*(b)*(h)
// FUNCTION PROTOTYPE AREA
void explain_prog(void); // used to explain the program
float get_base(void); // gets base and returns it as float
float get_height(void); // gets height and returns it as float
void display(float b,float h,float a); // takes base height area and displays it
main()
{

main()
{
// VARIABLE DECLARATIONS
float t_base, t_height, t_area;
system(“cls”); // clear the screen
explain_prog(); // explain program to user
// GET USER INPUT
t_base=get_base(); // t_base gets output of get_base()
t_height=get_height(); // t_height gets output of get_height()
// CALCULATE AREA
t_area = area_tri(t_base,t_height); // t_area uses #define to get area
// DISPLAY RESULTS
display(t_base,t_height,t_area); // displays base height and area
// WAIT FOR ANY KEY to EXIT
puts(“”);
system(“pause”);
}
// FUNCTION DEFINITIONS
void explain_prog(void) // explains program to user
{
puts(“The user is asked to type in the BASE”);
puts(“and HEIGHT of a TRIANGE, and the program”);
puts(“will output the HEIGHT, BASE and AREA”);
puts(“of the TRIANGLE.”);
puts(“”);
}
float get_base(void) // returns base to calling program
{
float base;
printf(“\nPlease input BASE of your triangle ==> “);
scanf(“%f”,&base);
return(base);
}
float get_height(void) // returns height to calling program
{
float height;
printf(“\nPlease input HEIGHT of your triangle ==> “);
scanf(“%f”,&height);
return(height);
}
void display(float b,float h,float a) // displays b, h, and a to screen
{
printf(“\nFor Base %.2f and Height %.2f, the AREA is %.2f”,b,h,a);
}

2. Convert the previous version of the program that uses a #define to calculate and return the area, to the
following version which uses a FUNCTION to calculate and return the area, and save as ASSIGN3B
/*
Title: Triangle Area Calculation Program - using a FUNCTION
Author: YOUR NAME HERE
Date: TODAY’S DATE HERE
Description: The user is asked to type in the BASE
and HEIGHT of a TRIANGE, and the program
will output the HEIGHT, BASE and AREA
of the TRIANGLE.
*/
// INCLUDE SECTION
#include // used for printf, scanf, getchar, puts
#include // used for getch
#include // used for system
// FUNCTION PROTOTYPES
float tri_area(float base, float height); //function returns area of triangle
void explain_prog(void); // used to explain the program
float get_base(void); // gets base and returns it as float
float get_height(void); // gets height and returns it as float
void display(float b, float h, float a); // takes base height area and displays it
main()
{
// VARIABLE DECLARATIONS
float t_base, t_height, t_area;
system(“cls”);
explain_prog(); // explains program to user
// GET USER INPUT
t_base=get_base(); // t_base gets output of get_base()
t_height=get_height(); // t_height gets output of get_height()
// CALCULATE AREA
t_area = tri_area(t_base,t_height); // t_area uses function to get area
// DISPLAY RESULTS
display(t_base,t_height,t_area); // displays base height and area
// WAIT FOR ANY KEY to EXIT
puts(“”);
system(“pause”);
}
// FUNCTION DEFINITIONS
void explain_prog(void) // explains program to user
{
puts(“The user is asked to type in the BASE”);
puts(“and HEIGHT of a TRIANGE, and the program”);
puts(“will output the HEIGHT, BASE and AREA”);
puts(“of the TRIANGLE.”);
puts(“”);
}

3. Write a third version of this code called ASSIGN3C that does everything in main(). If you wish you
can still use the #define to do the calculation.

Friday, November 2, 2007

Strike Back

Game này có rất nhiều level , càng chơi lên cao thì càng khó và rất hấp dẫn , anh em cùng chơi thử xem nào !Về âm thanh và hình ảnh thì không có gì phải chê , phải nói là tuyệt vời Dùng các nút sau để điều khiển :w : lêns : xuốnga : tráid : phảir : thay đạng : quăng súngmouse 1 : bắn từng viên (mạnh) - dùng để bắn từng con lẻmouse 2 : bắn nhiều viên (yếu) - dùng để bắn lúc có cả bầy mouse 3 : quên rồi Cấu hình yêu cầu (System Requirements):OS: Windows ME/2000/XP/VISTACPU: 600MHz or faster ProcessorRAM: 128 MB
Download:
http://www.bigfishgames.com/download...ack/index.html

StepMania 3.9

Welcome to StepMania 3.9 for someone who love game like Audition and Super Dance Online.



Link download: http://www.stepmaniawiki.com/wiki/Downloads

Especially, you can also download your favorite music in that website: http://www.stepmaniadl.com/wiki/Download_Songs

Remember that, you could play StepMania 3.9 with dance pad. You just buy a dance pad and connect with computer by USB.

Wednesday, June 27, 2007