i have a couple questions about textfiles...
1. how do you make a folder to put the textfile into?
i want to have a folder that uses the first and last name given from user input that would hold the textfile specific to that person
2. how do you make it so u can log into that folder using a password and recall info from the textfile.
the information that goes into the textfile is input which is the first name and last name, which they must use to log in, as well as a 7 digit password. so now there in there account and that tells them what there statement balance is from last time and they can put more in or take some out in the deposits and withdrawls.
Code:
//This program written by Dan Kemper
//This program will balance your checkbook and print the results to a textfile named "checkbook.txt" or print the scrren to your printer
//Suggestions and other comments can be sent to my email: [email protected]
//Includes Header Files
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main ()
{
//Declares variables
char FirstName[20];
char LastName[30];
char Account[9];
int PrintStatement;
float Balance;
float Deposits;
float Withdrawls;
float NewBalance;
//Makes Textfile
ofstream outfile ("checkbook.txt",ios::trunc);
//Outputs to screen
cout << " AAA TTTTTTTTTTTTTTT MMMMM MMMMM\n";
cout << " AAAAA TTTTTTTTTTTTTTT MMMMMM MMMMMM\n";
cout << " AAA AAA TTTTTT MMM MMM MMM MMM\n";
cout << " AAA AAA TTTTTT MMM MMM MMM MMM\n";
cout << " AAAAAAAAAAA TTTTTT MMM MMM MMM MMM\n";
cout << " AAAAAAAAAAAAA TTTTTT MMM MMM MMM MMM\n";
cout << " AAA AAA TTTTTT MMM MMM MMM MMM\n";
cout << "AAA AAA TTTTTT MMM MMMMM MMM\n";
cout<<"\nPress [ENTER] to continue...\n";
cin.get();
cout << "\n\nThis program balances your checkbook.\n\n";
cout << "First Name: ";
//Asks user for input
cin.get(FirstName, 20);
cin.ignore(80, '\n');
cout << "Last Name: ";
cin.get(LastName, 30);
cin.ignore(80, '\n');
cout << "Account number: ";
cin.get(Account, 9);
cin.ignore(80, '\n');
cout << "\n\nStatement balance: ";
cin >> Balance;
cin.ignore(1);
cout << "\nOutstanding deposits: ";
cin >> Deposits;
cin.ignore(1);
cout << "\nOutstanding withdrawls: ";
cin >> Withdrawls;
cin.ignore(1);
//Conversions
NewBalance = Balance + Deposits - Withdrawls;
//Output Results
cout << "\nNew balance: ";
cout << setiosflags (ios::fixed) << setprecision(2) << NewBalance;
cout << "\n\nDo you want the above information to be printed to a textfile? (Y/N)\n";
cin >> PrintStatement;
cin.ignore(1);
do
{
//Prints to Textfile
outfile << "Name: " << FirstName << " " << LastName << "\n";
outfile << "Account Number: " << Account << "\n";
outfile << "Statement Balance: " << Balance << "\n";
outfile << "Outstanding Deposits: " << Deposits << "\n";
outfile << "Outstanding Withdrawls: " << Withdrawls << "\n";
outfile << "New Balance: " << setiosflags (ios::fixed) << setprecision(2) << NewBalance;
}
while (PrintStatement=='y' || PrintStatement=='Y');
cout << "Thank You!";
outfile.close();
//Stops program until button is pressed
cin.get();
return 0;
}
anyone understand what i'm tryin to do? just like a real ATM, sort of.