Member Avatar

[CODE]#include <iostream> using namespace std; int main() { int sum = 0; // Declare an int variable sum to accumulate the numbers int lowerbound; // Set the initial sum to 0 int upperbound; // Sum from 1 to this upperbound // Prompt user for an upperbound cout << "Enter a integer: "; cin >> upperbound; cout << "Enter another integer: "; cin >> lowerbound; while (lowerbound <= 100 && upperbound <= 100) { sum = sum + upperbound++ + lowerbound++; } // Print the result cout << "The total of the numbers " << upperbound << " and " << …

Member Avatar
-1 forum 18
Member Avatar

[CODE]if (option == 3) { { pmt = (percentage * earnings); cout << "pmt is " << pmt << endl; wr = (0.06 / 52.0); cout << "wr is " << wr << endl; n = (52 * actualage); cout << "n is " << n << endl; retirement = pmt * ((1 + wr)n - 1) / wr); cout << "You will have $" << retirement << " saved when you retire." << endl; }[/CODE]

Member Avatar
+0 forum 1
Member Avatar

[CODE]#include <iostream> #include <string> using namespace std; int main() { // Variable declarations allowing us to calculate string fullName; int weeklySalary; int weeks; string age; int option; int actualage; int earnings; double savingsPercentage; double percentage; int retirementage; double total; cout << "What is your name? "; getline(cin, fullName); cout << "How old are you? "; cin >> age; cin.ignore(); // Removes the control character... cout << "Please select an option: " << endl; // Main menu allowing selection of option. cout << "\t(1) Number of years to retirement" << endl; cout << "\t(2) Amount earned between now and retirement" << …

Member Avatar
+0 forum 5

The End.