Vous êtes sur la page 1sur 2

National University of Computer & Emerging Sciences

Islamabad
Programming for Engineers 1 Fall 2009
Assignment 4
Max Marks: 115
Course instructor: Asma Ahmed, Atif Jilani Date: 10 November 2009

Write a Library file MyNameMath.h and provide following math.h functions in it. The
functionality of each function must be exactly same as that of the original functions given in
math.h. All functions must take same type and number of arguments as that of original functions

Note: You are not allowed to use any math.h library function

Function Original Function Function Comments Marks


Mysin sin Use logic of 7
Assignment 3
Mysinh sinh Sine hyperbolic 5
function
Mycos cos Use logic of 7
Assignment 3
Mycosh cosh Cosine hyperbolic 5
function
Mytan tan sin/cos [Handle 7
special inputs]
Mytanh tanh Tangent hyperbolic 5
function
MySqrt sqrt 15
MyAbs abs Absolute value 5
MyCeil ceil Ceil 5
MyFloor floor Floor 5
Myexp exp Exponential 5
MyFabs fabs 7
Myfmod fmod Floating point 7
remainder
Mypow pow 5

If you make anyother function you will get extra credit [5 marks for each extra function]
Write a driver program to provide user interface to user for testing all of these functions. [25
Marks]
For making good looking User Interface you make find following document helpful. (only works
for Visual C++)
Changing Font Color and Back Ground Color in Visual C++
You need to include following header file
#include <windows.h>
There are 16 colors available each given a number.
0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White
Color attributes are specified by TWO hex digits -- the first corresponds to the background; the
second the foreground. Each digit can be any of the following values:
Sets the default console foreground and background colors.
Examples
Use following function
system(“color 70”)
7 is white 0 is black. This will make white background and black font color.
system("COLOR fc") produces light red on bright white

gotoxy in Visual C++


You can use following code to implement a function gotoxy that works exactly the same way as
gotoxy of Turbo C++. Write this function in your file and use it.

void gotoxy(int x,int y)


{
HANDLE console_handle;
COORD cursor_coord;
cursor_coord.X=x;
cursor_coord.Y=y;
console_handle= GetStdHandle( STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(console_handle,cursor_coord);
}

How to Clear screen in VC++


Use this function
system (“cls”) 

Ahsan
Digitally signed by Digitally signed by

Zubair
Ahsan Javed bUttt Zubair Amjad
DN: cn=Ahsan Javed DN: cn=Zubair Amjad,

Javed
bUttt, o=BZSolutionz, o=BZSolutionz,
ou=Coder, ou=Project Manager,

bUttt
email=i080253@nu.
edu.pk, c=PK
Date: 2009.11.05
20:42:14 +05'00'
Amjad email=i080209@nu.
edu.pk, c=PK
Date: 2009.11.05
20:41:38 +05'00'

Vous aimerez peut-être aussi