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
____ [38]
3 years ago
7

Write a function NumberOfPennies() that returns the total number of pennies given a number of dollars and (optionally) a number

of pennies. Ex: 5 dollars and 6 pennies returns 506.
Sample program:
#include
using namespace std;

int main() {
cout << NumberOfPennies(5, 6) << endl; // Should print 506
cout << NumberOfPennies(4) << endl; // Should print 400
return 0;
Computers and Technology
1 answer:
Over [174]3 years ago
4 0

Answer:

Following are the code to the given question:

#include <iostream>//header file  

using namespace std;

int NumberOfPennies(int ND, int NP=0)//defining a method that accepts two parameters  

{

return (ND*100 +NP);//use return keyword that fist multiply by 100 then add the value  

}

int main() //main method

{

cout << NumberOfPennies(5,6) << endl; // Should print 506

cout << NumberOfPennies(4) << endl; // Should print 400

return 0;

}

Output:

506

400

Explanation:

In the method "NumberOfPennies" it accepts two parameters that are "ND and NP" that uses the return keyword that multiply 100 in ND variable and add in NP variable and return its values.

In the main method it it uses the cout method that call the by accepts value in parameter and print its value.

You might be interested in
Describe how pseudocode makes programming more efficient for large programming tasks.
Talja [164]

Answer:Pseudocode helps us understand tasks in a language-agnostic manner. Is it best practice or suggested approach to have pseudocode creation as part of the development lifecycle? For instance:

Identify and split the coding tasks

Write pseudocode

Get it approved [by PL or TL]

Start Coding based on Pseudocode

Explanation: use phrasing tool if you want to write in your own words.

6 0
3 years ago
Read 2 more answers
Why is it that even though there aren't the max number of answers on a question, (or sometimes even NO answers) When I click the
maks197457 [2]
It has happened to me before. i think it’s just because someone is already typing an answer maybe ‍♀️ or try restarting the app and get back on it. might be jus a glitch from the app but either way hope you get it fixed :)
4 0
3 years ago
Qual è la differenza tra variabile semplice e variabile strutturata? <br>​
Mrrafil [7]

Answer:

Sia la variabile semplice che la variabile strutturata possono avere il diverso set di valori, ma entrambi differiscono poiché la variabile semplice può contenere solo i valori di un tipo di dati. Tuttavia, la variabile strutturata può contenere la variabile di diversi tipi di dati come la struttura in c ++ ed elencare in Python. Ci sono anche molti altri esempi.

Ad esempio in c ++:

int num;  è una variabile semplice

e   struct class

        {

             int roll;

             string name;

        } class[25];

è una variabile strutturata che può memorizzare i dettagli dei 26 studenti.

Explanation:

Si prega di controllare la sezione di risposta.

6 0
4 years ago
WILL MARK BRAINLIEST FOR ANYONES ANSWER!
Anvisha [2.4K]

Answer:

just know that bit gonna be running when I make mine Imma have 720 fps btw today sponsored is nord VPN

4 0
3 years ago
What is the difference between Windows 7 and Windows 10?
Tanzania [10]
Windows 10 is new and windows 7 is old
6 0
3 years ago
Other questions:
  • If you want a user to enter exactly 20 values which loop would be the best to use
    12·1 answer
  • List several things that geographers can map using remotely sensed data
    5·1 answer
  • _______________________ is a short-term program, typically 30 hours long, in which a therapist, social worker, or trained probat
    5·1 answer
  • (08.03 MC) Maya is a senior in high school and would like to pursue a career in web design. She needs more information about wha
    11·2 answers
  • Microprocessors can’t directly understand programming languages, so programs have to be converted into _____________ that corres
    15·1 answer
  • Match each document to its respective type.
    8·2 answers
  • An exact-match query is:
    13·1 answer
  • Love me love me say that u love me fool me fool me go on and fool me : ) answer the question thx
    6·2 answers
  • Wml script is used in? ​
    14·1 answer
  • To use Aggregate functions on subgroups within the total result set, place the Aggregate function in the Select clause and add t
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!