الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مساعدة عاجلة في C++

بدأه squ2006 في 2 ديسمبر 2008 · 2 رد · 1,131 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمة الله وبركاته

اهلا بجميع اعضاء هذا المنتدى الغالي .

لقد شاركت في هذا المنتدى وكل امل بان اجد احد يساعدني في حل هذه المسألة . طبعا هذي المسألة من احد الاختبارات الماضية لمادة سي بلس بلس . ياليت لو احد يحلها لكي يفيد منها جميع زوار المنتدى واعضاءه...

The problem is:

In an accounts-receivable system, there is generally a master file containing detailed information about each customer in the bank. As transaction accoutre (for example, sales are made and payments arrive), they are saved into a file. At the end of each business period, the file of transactions (called trans.txt) is applied to the master file (called oldmaster.txt), thus updating each account’s record of purchases and payments. During an updating run, the master file is rewritten as a new file (called newmaster.txt) which is then used at the end of the next business period to begin the updating process again.

The master file contains one record for each account in the bank with the following information: full customer name, account number, telephone number and outstanding balance. Table 1 shows sample oldmaster.txt file.

The transaction file contains one record for each transaction in the bank. The following information is saved for each transaction: account number, amount of transaction, type of transaction (‘D’ for deposits and ‘W’ for withdrawals). Table 2 shows a sample trans.txt file.

You are asked to develop an accounts-receivable program that will apply the transactions saved in the trans.txt file to the accounts saved in the oldmaster.txt file and produce a new master file called newmaster.txt which has the same format as the oldmaster.txt file.

Use the account number of each customer as the key to compare records from both files. Assume that the records of both files (trans.txt and oldmaster.txt) are sorted in increasing order of account number. The records of the new file (newmaster.txt) should also be sorted in increasing order. Your program should handle the following three cases:

1. When trans.txt or oldmater.txt is not found an appropriate error message should be displayed and the program stops

2. When a match occurs (i.e. records with the same account number appear on both the master and the transaction files), update the outstanding balance based on the type of transaction (i.e. add the transaction amount if the transaction type is deposit or subtract if the transaction is withdrawal), and write the “newmaster.dat” record.

3. When there is a master record for a particular account but no corresponding transaction record, merely write the master record to “newmaster.dat”.

4. When there is a transaction record but no corresponding master record, display the following error message:

“Unmatched transaction for account number ….”

Upon completion of processing both files, your program should also display the total balance of the “newmaster.dat” file. Figure 1 shows a sample run of the program and table 3 shows the resulting newmaster.txtx file.

alfaris_net_1228200990.jpg

alfaris_net_1228201425.jpg
#2

اتمنى لو احد يساعدني لو بشرح كيفيه عمل البرنامج انا لحد الان بدأت ف البرنامج وقدرت اجعل البرنامج يقرا الملفين ولكن ما اعرف ايش الخطوات الي التالية وكيف اعمل مقارنه للكونت نمبر هلا استخدم if function

#3

يوجد بالمرفقات بداية حلي اتمنى لو حد يساعدني بالخطوات التالية

مواضيع مشابهة