Write a program to illustrate the Ohm's Law, I=V/R. The program will first request to input an initial voltage (in volt), a fixed resistance (in ohm) and an incremental interval for voltage. A function should be written which will return the value of current (in amp) given a voltage and a resistance. Then the program will call the function and print out a table that shows the value of current under each increment of voltage. The maximum voltage is set to 50 volts. a) main () should handle all input and output. (This requires that variables in main are updated by the function.) b) Secondary function should handle all calculations. c) Set precision to 2. Example Output Enter the initial voltage (up to 50 in volt): 40 Enter the resistance (in ohm): 10 Enter the voltage incremental interval (in volt) : 2 Voltage (volt) Resistance (ohm) Current (amp) 40 10 4.00 42 10 4.20 44 10 4.40 46 10 4.60 48 10 4.80 50 10 5.00
Write a program to illustrate the Ohm's Law, I=V/R. The program will first request to input an initial voltage (in volt), a fixed resistance (in ohm) and an incremental interval for voltage. A function should be written which will return the value of current (in amp) given a voltage and a resistance. Then the program will call the function and print out a table that shows the value of current under each increment of voltage. The maximum voltage is set to 50 volts. a) main () should handle all input and output. (This requires that variables in main are updated by the function.) b) Secondary function should handle all calculations. c) Set precision to 2. Example Output Enter the initial voltage (up to 50 in volt): 40 Enter the resistance (in ohm): 10 Enter the voltage incremental interval (in volt) : 2 Voltage (volt) Resistance (ohm) Current (amp) 40 10 4.00 42 10 4.20 44 10 4.40 46 10 4.60 48 10 4.80 50 10 5.00
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 22PE
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
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.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr