convert into c++ program

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question

In this python program convert into c++ program. Thank you

Source Code:

print("The function is f(x)= 2x+3(2)")
print("Width is 0.05")
lowLim=float(input("Enter Lower Limit: "))
upperLim=float(input("Enter Upper Limit: "))
iterations = (upperLim - lowLim)/0.05
i=0
finAns = 0
while(i<iterations):
    print("_________________________________________________________________________________________________________________________________")
    print("Iteration:",(i + 1))
    print("Function\t\t|\tLower Limit \t|\t Upper Limit \t|\t LRAM Application (width=0.05) \t|\t Answer")
    initAns=((2*lowLim)+(3*2))*0.05
    print("f(x)= 2x+3(2) \t\t|\tx={:0.2f}\t\t|\tx={:0.2f}\t\t|\t f(x) = (2({:0.2f})+3(2) * 0.05\t|\t  {:0.2f}".format(lowLim,lowLim+0.05,lowLim,initAns))
    finAns += initAns
    lowLim+=0.05
    i += 1
print("_________________________________________________________________________________________________________________________________")
print("Final answer/Summation of all iterations is:",finAns)

 

..

See the picture below that's a output sample output of this program

Upper Limit
x=1.35
|Answer
Function
T
T
LRAM Application (width=0.05)
f(x) = (2(1.30)+3(2) * 0.05
Lower Limit
f(x)= 2x+3(2)
X=1.30
0.43
Iteration: 8
! Upper Limit
x=1.40
Function
Lower Limit
| x=1.35
LRAM Application (width=0.05) |
f(x) = (2(1.35)+3(2) * 0.05
Answer
f(x)= 2x+3(2)
0.44
Iteration: 9
! Upper Limit
x=1.45
|
LRAM Application (width=0.05) |
Function
Lower Limit
Answer
0.44
f(x)= 2x+3(2)
x=1.40
f(x) = (2(1.40)+3(2)
ө.05
Iteration: 10
Upper Limit
x-1.50
LRAM Application (width=0.e5) I
f(x) = (2(1.45)+3(2) * 0.05
Function
Lower Limit
Answer
f(x)- 2х+3(2)
X=1.45
0.45
Iteration: 11
I Lower Limit
x=1.50
|
Upper Limit
x=1.55
LRAM Application (width=0.05) |
f(x) = (2(1.50)+3(2) * 0.05
Function
Answer
f(x)= 2x+3(2)
0.45
Iteration: 12
I LRAM Application (width=e.05) |
f(x) = (2(1.55)+3(2)
Function
Lower Limit
! Upper Limit
Answer
0.46
f(x)= 2x+3(2)
x=1.55
x=1.60
0.05
Iteration: 13
Lower Limit
| x=1.60
Upper Limit
x=1.65
LRAM Application (width=0.e5) |
f(x) = (2(1.60)+3(2) * 0.05
Function
Answer
f(x)= 2x+3(2)
ө.46
Iteration: 14
Upper Limit
x=1.70
| LRAM Application (width=0.e5) |
f(x) = (2(1.65)+3(2) * 0.05
Function
Lower Limit
Answer
f(x)= 2x+3(2)
x=1.65
0.47
Iteration: 15
Function
LRAM Application (width=0.05) I
f(x) = (2(1.70)+3(2) * 0.05
Lower Limit
Upper Limit
Answer
f(x)= 2x+3(2)
x=1.70
x=1.75
0.47
Iteration: 16
Function
f(x)= 2x+3(2)
Lower Limit
Upper Limit
x=1.80
LRAM Application (width=0.e5) I
F(x) = (2(1.75)+3(2) * 0.05
Answer
x=1.75
0.48
Iteration: 17
Function
Upper Limit
x-1.85
| LRAM Application (width=0.e5) |
f(x) = (2(1.8e)+3(2) • 0.05
Lower Limit
Answer
f(x)= 2x+3(2)
X=1.80
0.48
Iteration: 18
Function
Lower Limit
Upper Limit
LRAM Application (width=0.05) |
Answer
0.49
f(x)= 2x+3(2)
x=1.85
x=1.90
F(x) = (2(1.85)+3(2) * 0.05
Iteration: 19
Function
f(x)= 2x+3(2)
! Upper Limit
X=1.95
LRAM Application (width=0.05) |
f(x) = (2(1.90)+3(2)
Lower Limit
Answer
x=1.90
0.49
Iteration: 20
LRAM Application (width=0.05) |
f(x) = (2(1.95)+3(2) * 0.05
Function
Lower Limit
Upper Limit
Answer
f(x)= 2x+3(2)
| x=1.95
x=2.00
0.50
Final answer/Summation of all iterations is: 8.95
--
Transcribed Image Text:Upper Limit x=1.35 |Answer Function T T LRAM Application (width=0.05) f(x) = (2(1.30)+3(2) * 0.05 Lower Limit f(x)= 2x+3(2) X=1.30 0.43 Iteration: 8 ! Upper Limit x=1.40 Function Lower Limit | x=1.35 LRAM Application (width=0.05) | f(x) = (2(1.35)+3(2) * 0.05 Answer f(x)= 2x+3(2) 0.44 Iteration: 9 ! Upper Limit x=1.45 | LRAM Application (width=0.05) | Function Lower Limit Answer 0.44 f(x)= 2x+3(2) x=1.40 f(x) = (2(1.40)+3(2) ө.05 Iteration: 10 Upper Limit x-1.50 LRAM Application (width=0.e5) I f(x) = (2(1.45)+3(2) * 0.05 Function Lower Limit Answer f(x)- 2х+3(2) X=1.45 0.45 Iteration: 11 I Lower Limit x=1.50 | Upper Limit x=1.55 LRAM Application (width=0.05) | f(x) = (2(1.50)+3(2) * 0.05 Function Answer f(x)= 2x+3(2) 0.45 Iteration: 12 I LRAM Application (width=e.05) | f(x) = (2(1.55)+3(2) Function Lower Limit ! Upper Limit Answer 0.46 f(x)= 2x+3(2) x=1.55 x=1.60 0.05 Iteration: 13 Lower Limit | x=1.60 Upper Limit x=1.65 LRAM Application (width=0.e5) | f(x) = (2(1.60)+3(2) * 0.05 Function Answer f(x)= 2x+3(2) ө.46 Iteration: 14 Upper Limit x=1.70 | LRAM Application (width=0.e5) | f(x) = (2(1.65)+3(2) * 0.05 Function Lower Limit Answer f(x)= 2x+3(2) x=1.65 0.47 Iteration: 15 Function LRAM Application (width=0.05) I f(x) = (2(1.70)+3(2) * 0.05 Lower Limit Upper Limit Answer f(x)= 2x+3(2) x=1.70 x=1.75 0.47 Iteration: 16 Function f(x)= 2x+3(2) Lower Limit Upper Limit x=1.80 LRAM Application (width=0.e5) I F(x) = (2(1.75)+3(2) * 0.05 Answer x=1.75 0.48 Iteration: 17 Function Upper Limit x-1.85 | LRAM Application (width=0.e5) | f(x) = (2(1.8e)+3(2) • 0.05 Lower Limit Answer f(x)= 2x+3(2) X=1.80 0.48 Iteration: 18 Function Lower Limit Upper Limit LRAM Application (width=0.05) | Answer 0.49 f(x)= 2x+3(2) x=1.85 x=1.90 F(x) = (2(1.85)+3(2) * 0.05 Iteration: 19 Function f(x)= 2x+3(2) ! Upper Limit X=1.95 LRAM Application (width=0.05) | f(x) = (2(1.90)+3(2) Lower Limit Answer x=1.90 0.49 Iteration: 20 LRAM Application (width=0.05) | f(x) = (2(1.95)+3(2) * 0.05 Function Lower Limit Upper Limit Answer f(x)= 2x+3(2) | x=1.95 x=2.00 0.50 Final answer/Summation of all iterations is: 8.95 --
The function is f(x)= 2x+3(2)
Width is 0.05
Enter Lower Limit: 1
Enter Upper Limit: 2
Iteration: 1
Function
f(x)= 2x+3(2)
! Upper Limit
x=1.05
Lower Limit
LRAM Application (width=0.05)
f(x) = (2(1.00)+3(2)
Answer
0.40
x=1.00
* 0.05
Iteration: 2
Lower Limit
x=1.05
|
LRAM Application (width=0.e5) |
f(x) = (2(1.e5)+3(2) • 0.05
Function
Upper Limit
Answer
f(x)= 2x+3(2)
X=1.10
0.41
Iteration: 3
LRAM Application (width=0.05)
f(x) = (2(1.10)+3(2) * 0.05
Function
Lower Limit
Upper Limit
Answer
f(x)= 2x+3(2)
X=1.10
x=1.15
0.41
Iteration: 4
Lower Limit
I x=1.15
LRAM Application (width=0.05) |
f(x) = (2(1.15)+3(2) * 0.05
Function
Upper Limit
Answer
f(x)= 2x+3(2)
x=1.20
0.42
Iteration: 5
Upper Limit
LRAM Application (width=0.05) |
f(x) = (2(1.20)+3(2) * 0.05
Function
Lower Limit
Answer
f(x)= 2x+3(2)
x=1.20
x=1.25
0.42
Iteration: 6
Function
f(x)= 2x+3(2)
LRAM Application (width=0.05) I
f(x) = (2(1.25)+3(2) * 0.05
Lower Limit
Upper Limit
x=1.30
Answer
X=1.25
0.43
Iteration: 7
Function
f(x)= 2x+3(2)
Lower Limit
x=1.30
Upper Limit
x=1.35
LRAM Application (width=0.05) |
F(x) = (2(1.30)+3(2) * 0.05
Answer
0.43
Iteration: 8
Function
f(x)= 2x+3(2)
Upper Limit
I LRAM Application (width=e.05) |
f(x) = (2(1.35)+3(2) * 0.05
Lower Limit
!
x=1.40
Answer
x=1.35
0.44
Iteration: 9
Function
f(x)= 2x+3(2)
Upper Limit
x=1.45
LRAM Application (width=0.05) |
f(x) = (2(1.40)+3(2) * 0.05
Lower Limit
Answer
x=1.40
0.44
Iteration: 10
Function
f(x)= 2x+3(2)
Upper Limit
x-1.50
LRAM Application (width=0.05) |
f(x) = (2(1.45)+3(2) * 0.05
Lower Limit
Answer
x=1.45
0.45
Iteration: 11
Lower Limit
| x=1.50
! Upper Limit
x=1.55
Function
|
LRAM Application (width=0.05) |
Answer
f(x)= 2x+3(2)
f(x) = (2(1.50)+3(2) * 0.05 I
0.45
Iteration: 12
Function
f(x)= 2x+3(2)
LRAM Application (width=0.05) |
f(x) = (2(1.55)+3(2) * 0.05
Lower Limit
Upper Limit
Answer
x=1.55
X=1.60
ө.46
Iteration: 13
Function
f(x)= 2x+3(2)
LRAM Application (width=0.05) |
f(x) = (2(1.60)+3(2) * 0.05
Lower Limit
! Upper Limit
Answer
x=1.60
x=1.65
0.46
----. 14
Transcribed Image Text:The function is f(x)= 2x+3(2) Width is 0.05 Enter Lower Limit: 1 Enter Upper Limit: 2 Iteration: 1 Function f(x)= 2x+3(2) ! Upper Limit x=1.05 Lower Limit LRAM Application (width=0.05) f(x) = (2(1.00)+3(2) Answer 0.40 x=1.00 * 0.05 Iteration: 2 Lower Limit x=1.05 | LRAM Application (width=0.e5) | f(x) = (2(1.e5)+3(2) • 0.05 Function Upper Limit Answer f(x)= 2x+3(2) X=1.10 0.41 Iteration: 3 LRAM Application (width=0.05) f(x) = (2(1.10)+3(2) * 0.05 Function Lower Limit Upper Limit Answer f(x)= 2x+3(2) X=1.10 x=1.15 0.41 Iteration: 4 Lower Limit I x=1.15 LRAM Application (width=0.05) | f(x) = (2(1.15)+3(2) * 0.05 Function Upper Limit Answer f(x)= 2x+3(2) x=1.20 0.42 Iteration: 5 Upper Limit LRAM Application (width=0.05) | f(x) = (2(1.20)+3(2) * 0.05 Function Lower Limit Answer f(x)= 2x+3(2) x=1.20 x=1.25 0.42 Iteration: 6 Function f(x)= 2x+3(2) LRAM Application (width=0.05) I f(x) = (2(1.25)+3(2) * 0.05 Lower Limit Upper Limit x=1.30 Answer X=1.25 0.43 Iteration: 7 Function f(x)= 2x+3(2) Lower Limit x=1.30 Upper Limit x=1.35 LRAM Application (width=0.05) | F(x) = (2(1.30)+3(2) * 0.05 Answer 0.43 Iteration: 8 Function f(x)= 2x+3(2) Upper Limit I LRAM Application (width=e.05) | f(x) = (2(1.35)+3(2) * 0.05 Lower Limit ! x=1.40 Answer x=1.35 0.44 Iteration: 9 Function f(x)= 2x+3(2) Upper Limit x=1.45 LRAM Application (width=0.05) | f(x) = (2(1.40)+3(2) * 0.05 Lower Limit Answer x=1.40 0.44 Iteration: 10 Function f(x)= 2x+3(2) Upper Limit x-1.50 LRAM Application (width=0.05) | f(x) = (2(1.45)+3(2) * 0.05 Lower Limit Answer x=1.45 0.45 Iteration: 11 Lower Limit | x=1.50 ! Upper Limit x=1.55 Function | LRAM Application (width=0.05) | Answer f(x)= 2x+3(2) f(x) = (2(1.50)+3(2) * 0.05 I 0.45 Iteration: 12 Function f(x)= 2x+3(2) LRAM Application (width=0.05) | f(x) = (2(1.55)+3(2) * 0.05 Lower Limit Upper Limit Answer x=1.55 X=1.60 ө.46 Iteration: 13 Function f(x)= 2x+3(2) LRAM Application (width=0.05) | f(x) = (2(1.60)+3(2) * 0.05 Lower Limit ! Upper Limit Answer x=1.60 x=1.65 0.46 ----. 14
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education