ANSWERS: 2
  • //Ch3Lab.cpp - caloculates and displays the new weekly pay #include <iostream> using std::cout; using std::cin; using std::endl; int main() { //declair variables double beginningBalance = 0.0; double depositAmount = 0.0; double sum = 0.0; double withdrawalAmount = 0.0; //enter input items cout << "Enter beginning balance: "; cin >> beginningBalance; cout << "Enter deposit amount: "; cin >> depositAmount; cout << "Enter withdrawal amount: "; cin >> withdrawalAmount; //calculate withdrawal amount and endingBalance sum = beginningBalance + depositAmount; endingBalance = sum – withdrawalAmount; //display ooutput item cout << "Ending Balance: " << endingBalance << endl; return 0; } //end of main function
  • It's been a long time since I've done any C++...but I notice you didn't declare endingBalance.

Copyright 2023, Wired Ivy, LLC

Answerbag | Terms of Service | Privacy Policy