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
Frist one:
Write the program, rectangle.cpp, to read in the length and width of a rectangle and print
1.
The area of the rectangle
2.
The perimeter of the rectangle
3.
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.
Second problem:
other problem:
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:
4 dollars
2 quarters
0 dimes
1 nickels
2 pennies
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

#include <iostream>
using namespace std;
int main ()
{
int dollars;
int quarters;
int dimes;
int nickels;
int pennies;
// 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