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 is true about content based filtering
AleksAgata [21]

Answer: provide more info

Explanation:

8 0
3 years ago
Indicates the beginning and ending of your code written in HTML
lawyer [7]

Answer:

<body> ...</body>

indicates the beginning and ending of your code written in HTML

Explanation:

4 0
3 years ago
Assuming deq is a deque object, the expression deq.push_front(elem) deletes the first element from deq.
horrorfan [7]

Answer: False

Explanation:

This code code not deletes element from deq. This insert element at the beginning of deq. if it was deq.pop_front(elem) then it would have deleted the first element.

Therefore, it is false.

4 0
3 years ago
The text size can be found in ?
Greeley [361]

Answer:

Microsoft word.

Explanation:

i am very sorry if the answer is wrong

3 0
3 years ago
What is one problem you should keep in mind when researching information on the Internet?
shepuryov [24]
The answer is A due to the internet being a plethora of information being accessed by anyone and everyone with internet access. Any person of no background to certain information could claim mastery to the field and sway his/her audience to ways possible. Ensuring that the source of the information being read is from credible and reputable companies. You can do this by ensuring the information is from newspapers with names known all over the world or there are also sourced footnotes from the author where they could have cited some information from other articles. 
5 0
3 years ago
Read 2 more answers
Other questions:
  • In dt.py, you will implement a basic decision tree classifier for
    5·1 answer
  • What is the recommended size for bulleted text?
    5·2 answers
  • Cover page styles in the cover page gallery match the preformatted styles in word, making it easier to create a coherent style b
    5·1 answer
  • When it comes to safety, the choice to be safe is often up to __________?
    8·1 answer
  • You can advance slides during a slideshow by pressing the page down key
    7·1 answer
  • Powerpoint provides only three picture effects. true or false.
    5·1 answer
  • Does players report you on Mobile legends bang bang for playing your own Music while your playing yes or no
    11·1 answer
  • What is a relationship between a object and a class?
    7·1 answer
  • The two main methods of verification
    6·1 answer
  • What are the benefits of transferable skills check all the boxes that apply
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!