Project2ATMDesign.ppt

Download Report

Transcript Project2ATMDesign.ppt

Project 2 Overview
Start Part 1 Today
Part 2 handed out later
Turn in both by 8/3
New Skills Needed
• Working with ASCII Art
• How to append to an existing file
– ofstream trans(“transactions.txt”, ios::app);
• How to jump to one line of file and modify
– seekg and seekp
– fstream accts("accounts.txt", ios::in | ios::out);
• Accessing Date/Time
Using seekg/seekp
–
–
–
–
–
–
–
fstream accts("accounts.txt", ios::in | ios::out);
accts.seekg(recordNum*BYTES_PER_REC, ios::beg);
accts>>userID>>name>>PIN>>balance;
…
…
accts.seekp(recordNum*BYTES_PER_REC, ios::beg);
accts<<userID<<" "<<name<<" "<<PIN<<balance;
– accts.close();
Formatting removed
for clarity
(but is very important!)
Working with ASCII Art
• Visit www.schnoggo.com/figlet.html
• Replace \ with \\
Date and Time
char dateStr[9], timeStr[9]; // time and date vars
_strdate(dateStr);
// dateStr now has date
_strtime(timeStr);
// timeStr now has time
#include<ctime>