I'm trying to create an program that:
1. Prompts the user to enter three numbers and show the largest of the
three.
2.Takes the largest number and raises it to the smallest number.
3.Takes that result and raises it to the middle number.
I'm have step1 and 2 down, but I'm having trouble with the third
function which is step3. Here is the code I have for the function so
far:
//Raises the result of powerhouse1 to the middle
double powerhouse2(double mth, double nth, double oth)
{
double lowrise = pow(mth, oth);
double higherrise = pow(lowrise, nth);
return higherrise;
} 2 1132
BIGeasy wrote: I'm trying to create an program that: 1. Prompts the user to enter three numbers and show the largest of the three. 2.Takes the largest number and raises it to the smallest number. 3.Takes that result and raises it to the middle number.
I'm have step1 and 2 down, but I'm having trouble with the third function which is step3. Here is the code I have for the function so far:
//Raises the result of powerhouse1 to the middle double powerhouse2(double mth, double nth, double oth) { double lowrise = pow(mth, oth);
So, 'mth' is the largest and 'oth' is the smallest, I take it? So, nth
is the middle, right?
double higherrise = pow(lowrise, nth);
return higherrise; }
Given the assumptions I divined, the function is OK. You could, of
course, write a single return statement:
double powerhouse2(double mth, double nth, double oth)
{
return pow(pow(mth, oth), nth);
}
but what the hay...
V
"BIGeasy" <im*********@yahoo.com> wrote in message
news:78**************************@posting.google.c om... I'm trying to create an program that: 1. Prompts the user to enter three numbers and show the largest of the three. 2.Takes the largest number and raises it to the smallest number. 3.Takes that result and raises it to the middle number.
I'm have step1 and 2 down, but I'm having trouble with the third function which is step3. Here is the code I have for the function so far:
//Raises the result of powerhouse1 to the middle double powerhouse2(double mth, double nth, double oth) { double lowrise = pow(mth, oth); // <-- step 2 double higherrise = pow(lowrise, nth); // <-- step 3
return higherrise; }
What problem are you having? This looks to me like it would work.
Although, it is doing both step 2 and step 3, wherease you've stated you're
doing step 2 ok, but having trouble with step 3. I don't know what
powerhouse1 is doing, but powerhouse2 is raising mth to the power oth, then
raising the result of that to the power nth, which is what steps 2 and 3
(combined) should do, correct?
-Howard This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mike |
last post by:
I am sure that I am making a simple boneheaded mistake and I would
appreciate your help in spotting in. I have just installed
apache_2.0.53-win32-x86-no_ssl.exe
php-5.0.3-Win32.zip...
|
by: edgrsprj |
last post by:
PROPOSED EARTHQUAKE FORECASTING
COMPUTER PROGRAM DEVELOPMENT EFFORT
Posted July 11, 2005
My main earthquake forecasting Web page is:
http://www.freewebz.com/eq-forecasting/Data.html
...
|
by: Tom Lee |
last post by:
Hi,
I'm new to .NET 2003 compiler. When I tried to compile my
program using DEBUG mode, I got the following errors in the
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
\include\xdebug...
|
by: christopher diggins |
last post by:
I am wondering if any can point me to any open-source library with program
objects for C++ like there is in Java? I would like to be able to write
things like
MyProgram1 >> MyProgram2 >>...
|
by: Eric Whittaker |
last post by:
hi all,
im trying to write my first c++ program. a success, but i can't get the
window to stay open after user enters input. it just automatically closes.
right now the end of my program looks...
|
by: Hemal |
last post by:
Hi All,
I need to know the memory required by a c program. Is there any
tool/utility which can give me the memory usage in terms of DATA
segment, TEXT segment, BSS segment etc.
I am working...
|
by: ibtc209 |
last post by:
I just started programming in C, and I need some help with this problem.
Your program will read the information about one MiniPoker hand, namely the rank and suit of the hand’s
first card, and...
|
by: Banfa |
last post by:
Posted by Banfa
The previous tutorial discussed what programming is, what we are trying to achieve, the answer being a list of instructions constituting a valid program. Now we will discuss how...
|
by: amitpatel66 |
last post by:
There is always a requirement that in Oracle Applications, the Concurrent Program need to be execute programatically based on certain conditions/validations:
Concurrent programs can be executed...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |