SlideShare a Scribd company logo
1 of 2
Exercise 7
• Write a C++ program to calculate and display the slope
of the line connecting the two points with coordinates
(-12,2) and (14,6.5). The formula to calculate the
midpoint of two points are as follows:
• slope = (y2 – y1)/(x2-x1) ;
• Your program should use manipulators to display your
slope value in the following format (with 2 decimal
places and left justified):
• The value of the slope is xxx.xx
1
Exercise 7
2
x1, y1
(-12,2)
x2,y2
(14, 6.1)
-12 14
6.5
2

More Related Content

What's hot

Graphing Functions and Their Transformations
Graphing Functions and Their TransformationsGraphing Functions and Their Transformations
Graphing Functions and Their Transformationszacho1c
 
7th pre alg -l55
7th pre alg -l557th pre alg -l55
7th pre alg -l55jdurst65
 
Alg March 24, 2009
Alg March 24, 2009Alg March 24, 2009
Alg March 24, 2009Mr. Smith
 
[Sbp] trial spm sbp_2013_maths_paper2_[a]
[Sbp] trial spm sbp_2013_maths_paper2_[a][Sbp] trial spm sbp_2013_maths_paper2_[a]
[Sbp] trial spm sbp_2013_maths_paper2_[a]Karthik Karunanithy
 
Integrals
IntegralsIntegrals
Integralsdean38
 
Graph of quadratic function
Graph of quadratic functionGraph of quadratic function
Graph of quadratic functionNadeem Uddin
 
Skema mt-k2-pp-spm-t5-2017-set-a
Skema mt-k2-pp-spm-t5-2017-set-aSkema mt-k2-pp-spm-t5-2017-set-a
Skema mt-k2-pp-spm-t5-2017-set-aTuisyen Geliga
 

What's hot (11)

Graphing Functions and Their Transformations
Graphing Functions and Their TransformationsGraphing Functions and Their Transformations
Graphing Functions and Their Transformations
 
Chapter 1 review
Chapter 1 reviewChapter 1 review
Chapter 1 review
 
7th pre alg -l55
7th pre alg -l557th pre alg -l55
7th pre alg -l55
 
Alg March 24, 2009
Alg March 24, 2009Alg March 24, 2009
Alg March 24, 2009
 
Math hssc-ii-a1
Math hssc-ii-a1Math hssc-ii-a1
Math hssc-ii-a1
 
[Sbp] trial spm sbp_2013_maths_paper2_[a]
[Sbp] trial spm sbp_2013_maths_paper2_[a][Sbp] trial spm sbp_2013_maths_paper2_[a]
[Sbp] trial spm sbp_2013_maths_paper2_[a]
 
L6 continuity
L6 continuityL6 continuity
L6 continuity
 
Integrals
IntegralsIntegrals
Integrals
 
Graph of quadratic function
Graph of quadratic functionGraph of quadratic function
Graph of quadratic function
 
Sifat Operasi Hitung
Sifat Operasi HitungSifat Operasi Hitung
Sifat Operasi Hitung
 
Skema mt-k2-pp-spm-t5-2017-set-a
Skema mt-k2-pp-spm-t5-2017-set-aSkema mt-k2-pp-spm-t5-2017-set-a
Skema mt-k2-pp-spm-t5-2017-set-a
 

Viewers also liked (8)

Exercise 9 (ch 4) s1
Exercise 9 (ch 4)  s1Exercise 9 (ch 4)  s1
Exercise 9 (ch 4) s1
 
Chapter05
Chapter05Chapter05
Chapter05
 
Chapter03
Chapter03Chapter03
Chapter03
 
Chapter01
Chapter01Chapter01
Chapter01
 
Control structures selection
Control structures   selectionControl structures   selection
Control structures selection
 
Chapter02
Chapter02Chapter02
Chapter02
 
Selection Statements in C Programming
Selection Statements in C ProgrammingSelection Statements in C Programming
Selection Statements in C Programming
 
Flowchart
FlowchartFlowchart
Flowchart
 

More from IIUM

How to use_000webhost
How to use_000webhostHow to use_000webhost
How to use_000webhostIIUM
 
Chapter 2
Chapter 2Chapter 2
Chapter 2IIUM
 
Chapter 1
Chapter 1Chapter 1
Chapter 1IIUM
 
Kreydle internship-multimedia
Kreydle internship-multimediaKreydle internship-multimedia
Kreydle internship-multimediaIIUM
 
03phpbldgblock
03phpbldgblock03phpbldgblock
03phpbldgblockIIUM
 
Chap2 practice key
Chap2 practice keyChap2 practice key
Chap2 practice keyIIUM
 
Group p1
Group p1Group p1
Group p1IIUM
 
Tutorial import n auto pilot blogspot friendly seo
Tutorial import n auto pilot blogspot friendly seoTutorial import n auto pilot blogspot friendly seo
Tutorial import n auto pilot blogspot friendly seoIIUM
 
Visual sceneperception encycloperception-sage-oliva2009
Visual sceneperception encycloperception-sage-oliva2009Visual sceneperception encycloperception-sage-oliva2009
Visual sceneperception encycloperception-sage-oliva2009IIUM
 
03 the htm_lforms
03 the htm_lforms03 the htm_lforms
03 the htm_lformsIIUM
 
Exercise on algo analysis answer
Exercise on algo analysis   answerExercise on algo analysis   answer
Exercise on algo analysis answerIIUM
 
Redo midterm
Redo midtermRedo midterm
Redo midtermIIUM
 
Heaps
HeapsHeaps
HeapsIIUM
 
Report format
Report formatReport format
Report formatIIUM
 
Edpuzzle guidelines
Edpuzzle guidelinesEdpuzzle guidelines
Edpuzzle guidelinesIIUM
 
Final Exam Paper
Final Exam PaperFinal Exam Paper
Final Exam PaperIIUM
 
Final Exam Paper
Final Exam PaperFinal Exam Paper
Final Exam PaperIIUM
 
Group assignment 1 s21516
Group assignment 1 s21516Group assignment 1 s21516
Group assignment 1 s21516IIUM
 
Avl tree-rotations
Avl tree-rotationsAvl tree-rotations
Avl tree-rotationsIIUM
 
Week12 graph
Week12   graph Week12   graph
Week12 graph IIUM
 

More from IIUM (20)

How to use_000webhost
How to use_000webhostHow to use_000webhost
How to use_000webhost
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Kreydle internship-multimedia
Kreydle internship-multimediaKreydle internship-multimedia
Kreydle internship-multimedia
 
03phpbldgblock
03phpbldgblock03phpbldgblock
03phpbldgblock
 
Chap2 practice key
Chap2 practice keyChap2 practice key
Chap2 practice key
 
Group p1
Group p1Group p1
Group p1
 
Tutorial import n auto pilot blogspot friendly seo
Tutorial import n auto pilot blogspot friendly seoTutorial import n auto pilot blogspot friendly seo
Tutorial import n auto pilot blogspot friendly seo
 
Visual sceneperception encycloperception-sage-oliva2009
Visual sceneperception encycloperception-sage-oliva2009Visual sceneperception encycloperception-sage-oliva2009
Visual sceneperception encycloperception-sage-oliva2009
 
03 the htm_lforms
03 the htm_lforms03 the htm_lforms
03 the htm_lforms
 
Exercise on algo analysis answer
Exercise on algo analysis   answerExercise on algo analysis   answer
Exercise on algo analysis answer
 
Redo midterm
Redo midtermRedo midterm
Redo midterm
 
Heaps
HeapsHeaps
Heaps
 
Report format
Report formatReport format
Report format
 
Edpuzzle guidelines
Edpuzzle guidelinesEdpuzzle guidelines
Edpuzzle guidelines
 
Final Exam Paper
Final Exam PaperFinal Exam Paper
Final Exam Paper
 
Final Exam Paper
Final Exam PaperFinal Exam Paper
Final Exam Paper
 
Group assignment 1 s21516
Group assignment 1 s21516Group assignment 1 s21516
Group assignment 1 s21516
 
Avl tree-rotations
Avl tree-rotationsAvl tree-rotations
Avl tree-rotations
 
Week12 graph
Week12   graph Week12   graph
Week12 graph
 

Exercise 7b s1

  • 1. Exercise 7 • Write a C++ program to calculate and display the slope of the line connecting the two points with coordinates (-12,2) and (14,6.5). The formula to calculate the midpoint of two points are as follows: • slope = (y2 – y1)/(x2-x1) ; • Your program should use manipulators to display your slope value in the following format (with 2 decimal places and left justified): • The value of the slope is xxx.xx 1