Question

Create a program which asks for two numbers. The first number should be a decimal number...

Create a program which asks for two numbers. The first number should be a decimal number the second should be a whole number. The first number needs to be raised to the power of the second number. The answer should be formatted with two digits after the decimal. The output should look like the example output given. You may use your own data but output needs to be formatted same way. Pow() function should be used correctly in program.

Output for Extra

Its C++ programming language. I use Visual Studio 2019 by the way, this class is Programming Fundamental. I need your help!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#source code for firstNumber^secondNumber

#include <iostream>
#include<cmath>
using namespace std;
int main()
{
double firstNumber;
int secondNumber;
cout<<"Enter decimal number:";
cin>>firstNumber;
cout<<"Enter whole number:";
cin>>secondNumber;
if(secondNumber<0){
cout<<"The number is not whole number";
}
double output=pow(firstNumber,secondNumber);
printf("%.2f",output);
return 0;
}

main.cpp 1 #include <iostream> 2 #include<cmath> 3 using namespace std; 4 int main() 5- { double firstNumber; int secondNumbe

#source code to the secondNumber^firstNumber

#include <iostream>
#include<cmath>
using namespace std;
int main()
{
double firstNumber;
int secondNumber;
cout<<"Enter decimal number:";
cin>>firstNumber;
cout<<"Enter whole number:";
cin>>secondNumber;
if(secondNumber<0){
cout<<"The number is not whole number";
}
double output=pow(secondNumber,firstNumber);
printf("%.2f",output);
return 0;
}

main.cpp 1 #include <iostream> 2 #include<cmath> 3 using namespace std; 4 int main() 5- { double firstNumber; int secondNumbe

#if you have any doubt comment below..if you like give thumbs up...

Add a comment
Know the answer?
Add Answer to:
Create a program which asks for two numbers. The first number should be a decimal number...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Digit to WordsWrite a C program that asks the user for a two-digit number, then prints...

    Digit to WordsWrite a C program that asks the user for a two-digit number, then prints the English wordfor the number. Your program should loop until the user wants to quit.Example:Enter a two-digit number: 45You entered the number forty-five.Hint: Break the number into two digits. Use one switch statement to print the word for the firstdigit (“twenty,” “thirty,” and so forth). Use a second switch statement to print the word for thesecond digit. Don’t forget that the numbers between 11...

  • Write a program to subtract large unsigned integers. Your program should prompt and read in two...

    Write a program to subtract large unsigned integers. Your program should prompt and read in two large unsigned integers. The two large integers should be stored arrays, one array for each integer. The integers should be stored with one digit per location in the two arrays. The first integer should be no smaller than the second. Your program should subtract the second integer from the first. The result should be stored in an array, again one digit per location in...

  • Language is C programming Student ID should be 8 numbers long. create a program to read...

    Language is C programming Student ID should be 8 numbers long. create a program to read your student ID number and store it in an array. Input can not be hard wired, I have to be able to input my number Then change the first number to a letter. If the same number repeats in other parts of your student ID, you must change that number to a letter as well. print original array and modified array as your output....

  • For this assignment you are to create two programming projects. The first should have a project...

    For this assignment you are to create two programming projects. The first should have a project directory with Lab02-2WriteNumbers and the second should have a project directory with Lab02-2ReadNumbers. Lab02-03WriteNumbers – Write a program that asks the user to enter five numbers. Use a double data type to hold the numbers. The program should create a file and save all five numbers to the file. Enter a number (1 of 5): 45 Enter a number (2 0f 5): 23 Enter...

  • Write a program to subtract large unsigned integers. Your program should prompt and read in two...

    Write a program to subtract large unsigned integers. Your program should prompt and read in two large unsigned integers. The two large integers should be stored arrays, one array for each integer. The integers should be stored with one digit per location in the two arrays. The first integer should be no smaller than the second. Your program should subtract the second integer from the first. The result should be stored in an array, again one digit per location in...

  • #1 To execute a correctly written program, you first need to _____.                 highlight the output...

    #1 To execute a correctly written program, you first need to _____.                 highlight the output commands in the code                 print the code for reference                 compile it to machine language                 compile it from machine language into the programming language of choice #2 Adding capabilities to working software is called the _____ phase.                 coding                 maintenance                 debugging                 brainstorming #3 A rectangle in a flowchart represents which of the following?                 One or more I/Os                ...

  • Write a program that asks the user to enter two numbers. Then compare the two numbers....

    Write a program that asks the user to enter two numbers. Then compare the two numbers. Display either:     "The first number is larger", or     "The second number is larger", or     "The numbers are the same".

  • Create a program that asks that asks the user for the number of males and females...

    Create a program that asks that asks the user for the number of males and females in a class. The program should display a percentage of males and females. For example, there are 5 males, and 15 females. That makes 20 people total. To find the percentage of males you can divide 5 by 20, which makes 0.25, or 25% HINT: USE A VARIABLE for every group of people that you will use in your calculation. Submit your .java source...

  • Python Programming 4th Edition: Write a program that asks the user for the number of feet....

    Python Programming 4th Edition: Write a program that asks the user for the number of feet. The program converts those feet to inches by using the formula ’12 * feet’. Hint: Define main () program Get the number of feet from the user Define variables Call a function feet_to_inches(feet) The function receives the number of feet and returns the number of inches in that many feet. The output should look like as follows: Enter the number of feet: If the...

  • For this assignment you are to create two programming projects. The first should have a project...

    For this assignment you are to create two programming projects. The first should have a project directory with Lab02-2WriteNumbers and the second should have a project directory with Lab02-2ReadNumbers. Lab02-03WriteNumbers – Write a program that asks the user to enter five numbers. Use a double data type to hold the numbers. The program should create a file and save all five numbers to the file. Enter a number (1 of 5): 45 Enter a number (2 0f 5): 23 Enter...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT