1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Butoxors [25]
4 years ago
9

Galleons, Sickles, and Knuts are types of coinage from the Harry Potter franchise. Write source code in C++ that converts the nu

mber of Galleons to Knuts. Your program should have a reasonable prompt for the user to enter a number of Galleons. Hint: There are 493 Knuts in a Galleon.
Computers and Technology
1 answer:
olga2289 [7]4 years ago
4 0

Answer:

The c++ program for the given scenario is given below.

#include <iostream>

using namespace std;

int main() {

   double galleons, knuts;    

   cout << " This program converts Galleons to Knuts " << endl;

   cout << " Enter the number of galleons to be converted into knuts: " << endl;

   cin >> galleons;    

   knuts = galleons * 493;    

   cout << galleons << " Galleons is equivalent to " << knuts << " Knuts. " << endl;

   return 0;

}

OUTPUT

For decimal value.

This program converts Galleons to Knuts  

Enter the number of galleons to be converted into knuts:  

1.1

1.1 Galleons is equivalent to 542.3 Knuts.  

For integer value.

This program converts Galleons to Knuts  

Enter the number of galleons to be converted into knuts:  

2

2 Galleons is equivalent to 986 Knuts.

Explanation:

This program uses two variables to holds galleons and knuts which are declared with data type double.

 double galleons, knuts;

The data type double is taken since it can hold both integer and decimal values.

The variables are not initialized since the program is supposed to take user input for the number of galleons to be converted to knuts as shown below.

The cout keyword is used to print to the standard output.

 cout << " Enter the number of galleons to be converted into knuts: " << endl;

The cin keyword is used to take the input from the user.

 cin >> galleons;

Galleons are converted into knuts using the conversion rate given in the question. The formula to convert galleons into knuts is given as follows.

  knuts = galleons * 493;

The entered number of galleons and the corresponding number of knuts are displayed to the standard output.

  cout << galleons << " Galleons is equivalent to " << knuts << " Knuts. " << endl;

In the program, endl keyword is used to insert new line.

The program terminates with the following statement since the return type of main is shown as integer.

 return 0;

You might be interested in
What can you learn at Udemy.com?
PtichkaEL [24]
You can learn all sorts of Programming tutorial and other stuff from udemy.com.
Thank you.
5 0
3 years ago
How have newspapers and magazines adapted to digital technology?
Ahat [919]

Answer:

Most newspapers now have online editions. Subscription models have gone beyond print-only into digital-only and print-digital combinations -- and as print-only circulation is dropping, digital and combination circulation is on the rise.

6 0
3 years ago
An app builder has created a report for sales people to view records from the custom object, some users have complained that the
a_sh-v [17]

Answer:

Check sharing rules

Check organization-wide defaults

Check the user s profile for object settings

Explanation:

There is a need for some people to see the total transparency of the records that are meant to be shared with a select group of people. There are certain things that can be done for this. The first one is that the sharing rules should be checked. To whom are the details shared with. The next one is the filters that are used.

These can be reported and changed accordingly. Lastly, the whole organization’s defaults can be checked. This is something that can be done when the previous methods that were done did not work that well. Once some changes are done, the people can check if they already work and if the records can be viewed.

6 0
4 years ago
Describe the three criteria you should use to determine if an online media source should be included in your paper or presentati
VikaD [51]
<span>To use an online resource, it should be relevant to the topic. It should be credible, coming from an expert on the topic. Finally, it should be valid, coming from a source that is based in truth or fact.</span>
7 0
3 years ago
Read 2 more answers
Readability is the level of vocabulary used on the page. True or false
konstantin123 [22]

Answer:

FALSE....john has no idea what hes talking about. i knew this was false yet i looked it up and got it wrong anyway because of john its freaking false

Explanation:

8 0
3 years ago
Other questions:
  • Why do nonprofit agencies often include blogs on their websites?
    5·1 answer
  • PLEASE HELP ASAP!! WILL MARK BRAINLIEST!! 20 POINTS!!
    6·1 answer
  • To get started with stock trading and to learn, many people start with this method to learn the ropes and practice with fake mon
    13·1 answer
  • A key requirement for the process of testing hypotheses in the scientific method is Group of answer choices experimenter bias. c
    9·1 answer
  • You can select multiple words by using the ______ keys repeatedly.
    6·1 answer
  • What does place value mean with binary?
    6·1 answer
  • Help teacher said with complete explanation ​
    5·1 answer
  • if prakash gives one of the marble from what he possessses to kamala then they will have equal number of marbles.if kamala gives
    10·1 answer
  • State the advantages of MS Excel in data encoding
    9·1 answer
  • Which option in PowerPoint allows users to configure the number of columns and rows manually, using numerical values?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!