Question 2 + m² >n. Write a procedure to calculate and return the value of m for a given integer n >0 where m is the smallest integer such that 1²+22+ 3² + . Procedure specification: • Prototype: int findMinBase (int n). Parameter(s): n Є Z. - Return value: If n > 0, procedure should return the correct m value. If n ≤ 0, your procedure should return -1. • e.g, minnBase (-10) = 1, minnBase (2) = -1, minnBase (-1) = = -1, minnBase (0) -1, minnBase (1) = 2, minnBase (10) = 3, minnBase (15) = 4. Main procedure specification: • Read n value using the input macro. • Call minnBase procedure to calculate the m value. • If returned m value is -1, use output macro to display a message box with the message "Incorrect n value”. Otherwise, use output macro to display the returned m value.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.4: A Case Study: Rectangular To Polar Coordinate Conversion
Problem 9E: (Numerical) Write a program that tests the effectiveness of the rand() library function. Start by...
icon
Related questions
Question
Question 2
+ m² >n.
Write a procedure to calculate and return the value of m for a
given integer n >0 where m is the smallest integer such that 1²+22+ 3² + .
Procedure specification:
•
Prototype: int findMinBase (int n).
Parameter(s): n Є Z.
- Return value: If n > 0, procedure should return the correct m value. If n ≤ 0,
your procedure should return -1.
• e.g, minnBase (-10)
= 1, minnBase (2)
=
-1,
minnBase (-1)
=
=
-1, minnBase (0) -1, minnBase (1)
=
2, minnBase (10) = 3, minnBase (15) = 4.
Main procedure specification:
• Read n value using the input macro.
• Call minnBase procedure to calculate the m value.
• If returned m value is -1, use output macro to display a message box with the
message "Incorrect n value”. Otherwise, use output macro to display the returned m
value.
Transcribed Image Text:Question 2 + m² >n. Write a procedure to calculate and return the value of m for a given integer n >0 where m is the smallest integer such that 1²+22+ 3² + . Procedure specification: • Prototype: int findMinBase (int n). Parameter(s): n Є Z. - Return value: If n > 0, procedure should return the correct m value. If n ≤ 0, your procedure should return -1. • e.g, minnBase (-10) = 1, minnBase (2) = -1, minnBase (-1) = = -1, minnBase (0) -1, minnBase (1) = 2, minnBase (10) = 3, minnBase (15) = 4. Main procedure specification: • Read n value using the input macro. • Call minnBase procedure to calculate the m value. • If returned m value is -1, use output macro to display a message box with the message "Incorrect n value”. Otherwise, use output macro to display the returned m value.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage