Professional Documents
Culture Documents
Projeekkkkk C+++ 2010
Projeekkkkk C+++ 2010
[Computer programming]
Project Title:
Assalamualaikum.. First of all,we would like to express our appreciation for the loving support we have received from our lectures,who have helped us in our quest to complete this project, Dr Junita Mohamad.Now,we realize how powerful c++ program can be as a software.It would be a hard and difficult task to complete this such of project,but with the c++ software and guidance from our lectures,this project has made a lot easier for us. Also,we would like to take this opportunity to thank those who have made this project a success especially to our lecturers, collegues, friends and seniors at Universiti Sains Malaysia,especially those from the school of Electrical and Electronic Engineering. . Thanks to all.
CONTENTS Cover page Acknowledgment Table of content Abstract Introduction Division of work Methodology Verification Procedure Conclusion Reference C++ source code Output program
PAGE 1 2 3 4 5 6 7 9 10 11 12 13
Our project is about solving quadratic equation.The users can simply choose any numbers in quadratic equation .Then, the program will run to display the root of that equation.This program are cater for real and complex root as well.
This project is our first mini project in c++ computer programming.After we have discussed about what we want to do in this project,finally we have decided to quadratic equation in our programming. In this project,our objectives is we try to solve the equation by using [b-(b-4ac)]/2a formula. Its means,when the user input the number for a,b and c in the equation,program will run to display the root according [b-(b-4ac)]/2a formula.If b4ac=0, then the root is real root.Meanwhile if b4ac>0,the equation has real and distict root.For the complex root ,must cater b-4ac<0. For complex root, it has 2 root, which 1 of the root is imaginary number.This is because negative integer is unexist, then the other root is symbol as i (imaginary number).
Project timeline
WEEK
WEEK 8 WEEK 9
DIVISION OF WORK
Every person in our group must find as many information as possible. Combine all the information together and choose the best information to be used in programming Study how to do programming correctly and excellently from the seniors or person who excel in C++ programming Start to do programming Continue to do programming and check any error that has been done Do double checking for error and try to debug Presentation starts
6
WEEK 10
PSEUDOCODE
1.Start the program 2.Declare the function prototype 3.Ask user to enter value for a,b and c that contain in the quadratic equation. 4.The program will detect the root either it is real root or complex root 5.The program will call the function and display the root by using given formula. 6.End of the program.
b-4ac
POSITIVE
NEGATIVE
X= (b-ROOT) / 2
YES
NO
END
CONTINUE
After compiling our programs,we have tried key in a number in the equation and the program display the correct answer.We have also tried our program with various equation and the roots obtain accurately.This survey also proved that our program is correct.
Our project was a success though we have met many unexpected roadblocks along the way. We have checked our program multiple times and tested its effectiveness with users around the campus as well as other programmers. Through this survey, we have realized that our program is user friendly and easy to understand. Our program is also unique and effective due to some tough equation that we have chosen to test the accuracy of our program.
10
11
root = b * b - 4.0 * a * c; if (root >= 0.0) { root = sqrt(root); x1 = (-b + root) / (2.0 * a); x2 = (-b - root) / (2.0 * a); cout << "Real roots " << x1 << " and " << x2 << endl; } else { root = sqrt(-root) / (2.0 * a); x1 = -b / (2.0 * a); cout << "Complex roots " << x1 << " +- j " << root << endl; 12
<<program output>>
13