Click here to Skip to main content
16,021,285 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Get LVN_MARQUEEBEGIN in CListCtrl Pin
Richard MacCutchan21-Aug-23 21:28
mveRichard MacCutchan21-Aug-23 21:28 
AnswerRe: Get LVN_MARQUEEBEGIN in CListCtrl Pin
Randor 22-Aug-23 1:23
professional Randor 22-Aug-23 1:23 
GeneralRe: Get LVN_MARQUEEBEGIN in CListCtrl Pin
Li Lin 202322-Aug-23 14:30
Li Lin 202322-Aug-23 14:30 
GeneralRe: Get LVN_MARQUEEBEGIN in CListCtrl Pin
Randor 23-Aug-23 1:11
professional Randor 23-Aug-23 1:11 
QuestionUpdate a value inside a class using a function Pin
alex136317-Aug-23 4:19
alex136317-Aug-23 4:19 
AnswerRe: Update a value inside a class using a function Pin
k505417-Aug-23 5:07
mvek505417-Aug-23 5:07 
GeneralRe: Update a value inside a class using a function Pin
alex136317-Aug-23 5:20
alex136317-Aug-23 5:20 
AnswerRe: Update a value inside a class using a function Pin
Richard MacCutchan17-Aug-23 5:19
mveRichard MacCutchan17-Aug-23 5:19 
In the deposit_amount function you should break out of the loop after updating the record. So change it to:
C++
while(File.read((char *) &ac, (int)sizeof(ac)))
{
    if(ac.retacno()==n)
    {
        ac.show_account();

            cout<<"\n\nEnter The amount to be deposited: ";
            cin>>amt;
            ac.dep(amt);

        int pos = -1 * (int)sizeof(ac);
        File.seekp(pos,ios::cur);
        File.write((char*)&ac, (int)sizeof(ac));
        cout<<"\n\n\t Record Updated";
        break; // ***do not need to read any further records
    }
}


In the display_all function change the while statement to:
C++
while(!inFile.read((char *) &ac, sizeof(ac)).eof()) // break if end of file

GeneralRe: Update a value inside a class using a function Pin
alex136317-Aug-23 5:44
alex136317-Aug-23 5:44 
GeneralRe: Update a value inside a class using a function Pin
Richard MacCutchan17-Aug-23 6:01
mveRichard MacCutchan17-Aug-23 6:01 
GeneralRe: Update a value inside a class using a function Pin
alex136317-Aug-23 6:04
alex136317-Aug-23 6:04 
GeneralRe: Update a value inside a class using a function Pin
k505417-Aug-23 6:53
mvek505417-Aug-23 6:53 
Questionpostmessage Pin
utcode9-Aug-23 20:52
utcode9-Aug-23 20:52 
AnswerRe: postmessage Pin
Richard MacCutchan9-Aug-23 21:33
mveRichard MacCutchan9-Aug-23 21:33 
GeneralRe: postmessage Pin
utcode10-Aug-23 18:07
utcode10-Aug-23 18:07 
GeneralRe: postmessage Pin
Richard MacCutchan10-Aug-23 21:22
mveRichard MacCutchan10-Aug-23 21:22 
GeneralRe: postmessage Pin
Victor Nijegorodov10-Aug-23 21:45
Victor Nijegorodov10-Aug-23 21:45 
QuestionWriting console c++ apps... console API or library? Pin
Texas45191-Aug-23 0:04
Texas45191-Aug-23 0:04 
AnswerRe: Writing console c++ apps... console API or library? Pin
Victor Nijegorodov1-Aug-23 0:15
Victor Nijegorodov1-Aug-23 0:15 
AnswerRe: Writing console c++ apps... console API or library? Pin
Richard MacCutchan1-Aug-23 0:31
mveRichard MacCutchan1-Aug-23 0:31 
AnswerRe: Writing console c++ apps... console API or library? Pin
CPallini1-Aug-23 1:02
mveCPallini1-Aug-23 1:02 
AnswerRe: Writing console c++ apps... console API or library? Pin
k50541-Aug-23 5:09
mvek50541-Aug-23 5:09 
AnswerRe: Writing console c++ apps... console API or library? Pin
jschell17-Aug-23 6:03
jschell17-Aug-23 6:03 
Questionparsing time (only) string with std::chrono Pin
Maximilien28-Jul-23 10:05
Maximilien28-Jul-23 10:05 
AnswerRe: parsing time (only) string with std::chrono Pin
Richard Andrew x6428-Jul-23 13:04
professionalRichard Andrew x6428-Jul-23 13:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.