C source code on Scientific calculator project PDF

Title C source code on Scientific calculator project
Course Object-Oriented Programming Me
Institution Stephen F. Austin State University
Pages 22
File Size 451.6 KB
File Type PDF
Total Downloads 24
Total Views 142

Summary

C source code on Scientific calculator project for oriented programming course and seminar. It's fully working and free to use...


Description

T ERM PAPER OF CSE-202 TOPIC:- SCIENTIFIC CALCULATOR

SUBMITTED BY NAME- BITTU KUMAR SECTION-E2801 ROLL NO. – A05 REGISTRATION NO. -10808479

SUBMITTED TO LECT. CHETNA MAM (DEPT. OF COMPUTER SC.)

1

ACKNOWLEDGEMENT As usual a large number of people deserve my thanks for the help they provided me for the preparation of this term paper.

First of all I would like to thank my teacher Lect. Chetna mam for her support during the preparation of this topic. I am very thankful for her guidance.

I would also like to thank my friends for the encouragement and information about the topic they provided to me during my efforts to prepare this topic.

At last but not the least I would like to thank seniors for providing me their experience and being with me during my work.

2

TABLE OF CONTENT:-

1.1 1.2

Introduction Logic of the programme

1.2.1 1.2.2 1.3 1.4 1.5 1.6

Creating the standard calculator Creating the scientific calculator

Control diagrame Output screen Source code of scientific calculator Refernces

3

1.1 INTRODUCTION:Accordingly, this project aims to develop source code in the form of a computer program i.e c++ that a scientific calculator could use to compute functions such as square root, the exponential, and sine functions and etc. The idea of this project that 1. Since all the mathematical function such as sin function, cos function, logarithm function are define in the library function of , thus we have return the value of the function to call function. 2. For menu deriven programme, here we have to use switch-case statement. 3. In this programme ,there are two type of calculator, a). Standard calculator. b). Scientific calculator. 4. The standard calculator contain simple function such as addition , substraction etc. whereas the scientific calculator contain function sin , cosin, tan, exponential function etc. The code of the calculator application mainly comprise of two classes standard calculator and scientific calculator. The standard calculator class helps to perform stanandard calculation. The scientific calculator class in the other hand, helps to perform scientific calculations. Both classes contain static function so a to ensure that these function can be called in the main function through class name.

1.2 LOGIC OF THE PROGRAMME:1.2.1. CREATING THE STANDARD CALCULATOR :The standard class aims at performing specific task related to standard calculation. These task are:1. 2. 3. 4. 5.

Adding two number Substracting the second number from the first number. Multiplying two number Dividing first number from second. Modulus of first number by second number.

4

To perform the above mentioned task, the standard calculator class implements the following member function. FUNCTION Addition Substraction Multiplication Division

DESCRIPTION returns the addition of two input number. returns the substraction of two number. returns the multiplication of two number. returns the output obtained after performing operation on the input number

1.2.2 CREATING SCIENTIFIC CALCULATOR:You have to need to creat scientific calculator class to perform task related to scientific calculations. Which include finding square or cube etc. The scientific calculator perform following task. 1. 2. 3. 4. 5. 6.

Determine the square of the number. Determine the square root of the number Determine the first number power of the second number Determine the factorial of a number Determine the sin, cos and tan value of the number. Determine the logarithm, natural logarithm and exponential of the number.

To perform the above mentioned task in scientific calculator implements the following member function. FUNCTION Square Squae root Cube Fact Sin_fun Cos_fun Tan_fun Log_fun Log10_fun Exp_fun

DESCRIPTION accept a number and returns the square of the number accept a number and returns the square root of number accept two number and returns the first power to 2nd num. returns a factorial of an input number. returns the sin value of an input number. return the cos value of an input number. return the tan value of an input number return the log value of an input number return the log10 value of an input number. return the exp value of an input number.

5

1.3 CONTROL DIAGRAM This diagram tells the interconnection between various menus and sub-menus.

Standard calculator

Frontscreen

Main Menu

Scientific calculato

This shows the transfer of control between various menus and sub menus

1.4.OUTPUT SCREEN 6

1.4.1. Main Screen:Choose the type of calculator

1.4.2 Scientific calculator screen:In scientific calculator, choose the type of function.

1.4.3. Result screen:7

Find your answere

1.5. SOURCE CODE OF SCIENTIFIC CALCULATOR IN C+ +:#include #include #include #include #define new_calc 1 #define old_calc 0 class stand_calc { public: static double addition(double,double); static double substract(double,double); static double multiplication(double,double); static double division(double,double *); static double modulus(double *,double *); }; class scien_calc { public: static double square(double); 8

static double cube(double); static double power(double,double); static double sq_root(double); static double sin_fun(double); static double cos_fun(double); static double tan_fun(double); static long int fact(double); static double log_fun(double); static double log10_fun(double); static double exp_fun(double); static double sqrt_fun(double); }; double stand_calc::addition(double a,double b) { return(a+b); } double stand_calc::substract(double a,double b) { return(a-b); } double stand_calc::multiplication(double a,double b) { return(a*b); } double stand_calc::division(double a,double *b) { while(*b==0) { cout...


Similar Free PDFs