So my teacher isn't very good at explaining things and I understand code a little bit when I toke a class using Matlab and C++ is trickery for me however I feel lost by how to write these codes because the example he provides as references are not at all helpful. It fine if you write in pseucode or code either way
Write the program, rectangle.cpp, to read in the length and width of a rectangle and print
The area of the rectangle
The perimeter of the rectangle
The diagonal across the rectangle
Assume that the values for the sides are positive but are NOT whole numbers. Be sure to prompt the user for input and label all results.
Hint: Remember the Pythagorean Theorem (a2 + b2 = c2) to calculate the diagonal.
Write the program, coins.cpp, that will read in an amount of money as dollars (an integer) and cents (an integer) and then prints the total number of coins required to make the change and then the as the number of pennies, nickels, dimes, quarters and dollar coins required for the money. Your answer should the smallest number of coins needed. The following is an example of your program executing (user input is bold, red and larger):
This program will tell you how many of which coins
are needed for the amount of money you enter.
Enter number of dollars: 4
Enter number of cents: 57
9 coins are required:
Your output should look like the example above for ANY dollar and cent values. Be sure to prompt the user for input and label all results.
Hint : Convert the input to total number of pennies and then use the modulus (remainder) operation and integer division to calculate the results. Only use integers for this problem. Do NOT use ANY floating point (double or float) values.
Requirement: Use named constants for the value of each coin. Do not use integer constant values (like 5, 10 and 25) in the calculations, but use the named constant instead.
using namespace std;
int main ()
// these are the variables
std::cout <<"Enter number of dollars";
cin >> dollars;
std::cout <<"Enter number (value) of cents";
cin >> (quarters + dimes + nickels + pennies);
// should be placing amounts given
int numberofquar = (quarters + dimes + nickels + pennies) / 25;
int numberofdimes = ((quarters + dimes + nickels + pennies) / 25) / 10;
int numberofnick = (((quarters + dimes + nickels + pennies) / 25) / 10) / 5;
int numberofpenny = ((((quarters + dimes + nickels + pennies) / 25) / 10) / 5) / 1;
int numberofdollar = dollars;
cout <<"number of coins needed" << endl;
cout <<"dollars" << endl;
cout << numberofdollar;
cout <<"quarters" << endl;
cout << numberofquar;
cout <<"dimes" << endl;
cout << numberofdimes;
cout <<"nickels" << endl;
cout << numberofnick;
cout <<"pennies" << endl;
cout << numberofpenny;
this was my attempt and it didn't work anyone know how I can fix it