Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

could you answer using c++ Change for a Dollar Game Create a change-counting gam

ID: 3751330 • Letter: C

Question

could you answer using c++

Change for a Dollar Game Create a change-counting game that gets the user to enter the number of coins required to make exactly one dollar. The program should ask the user to enter the number of pe coins entered is equal to one dolla program should display a message indicating whether the amount entered was more than or nnies, nickels, dimes, and quarters. If the total value of the r, the program should congratulate the user for winning the game. Otherwise, the less than one dollar.

Explanation / Answer


#include <iostream>

using namespace std;

int main()
{
int p,n,d,q;
  
cout << "Enter no.of pennies ";
cin >> p;
  
cout << "Enter no.of nickels";
cin >> n;
  
cout << "Enter no.of dimes";
cin >> d;
  
cout << "Enter no.of quarters ";
cin >> q;
if (p+(5*n)+(10*d)+(25*q)==100)
cout << " Congratulations you won the game";
else if(p+(5*n)+(10*d)+(25*q)>100)
cout << "It is more than 1 dollar";
else
cout << "It is less than 1 dollar";

return 0;
}