Address Book
This is a simple Address Book that writes to a sequential access file. It acts as two programs in one. It can create a new address file that you can write to or you can open an address file already created and read the file. This was just a program we had to do for class, but it can be modified to both read and write at the same time if you wanted to do that.
AI
KI-Zusammenfassung: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Quellcode
Upload
#include <iostream.h>
void fdeposit()
{
cout << "Enter the amount to be deposited\n";
cout << "$";
float amountdeposited = 0.00;
cin >> amountdeposited;
cout << "\n You deposited $" << amountdeposited << "\n";
}
void fwithdraw()
{
cout << "Enter the amount to be withdrawn\n";
cout << "$";
int amountwithdrawn = 0;
cin >> amountwithdrawn;
int temp = 0;
int numberof50s = 0;
int numberof20s = 0;
temp = (amountwithdrawn % 10);
if (temp != 0.00)
{
cout << "That amount can not be withdrawn\n";
return;
}
if (amountwithdrawn < 20)
{
cout << "That amount can not be withdrawn\n";
return;
}
temp = amountwithdrawn / 10;
if (temp % 5 == 0)
{
numberof50s = (temp / 5);
}
else
{
if (temp % 2 == 0)
{
numberof20s = (temp / 2);
}
}
if ((temp % 5)%2 == 0)
{
numberof50s = (temp / 5);
numberof20s = ((temp %5)/2);
}
cout << numberof50s << " $50 bills withdrawn\n";
cout << numberof20s << " $20 bills withdrawn\n";
cout << "$" << amountwithdrawn << " withdrawn\n";
}
int main()
{
cout << "ID = \t C0103060x\n";
cout << "NAME = \t Claudio A";
enum menuoptions { deposit = 1, withdraw = 2, balance = 3};
cout << "Press the corresponding number to access an option\n";
cout << "1. Deposit money\n";
cout << "2. Withdraw money\n";
cout << "3. Balance Inquiry\n";
int choice = 0;
cin >> choice;
if (choice == deposit)
fdeposit();
if (choice == withdraw)
fwithdraw();
if (choice == balance)
cout << "Sorry, that option is not yet available!\n";
return 0;
}
Originalkommentare (3)
Wiederhergestellt von der Wayback Machine