POLALA.COM
welcome to my space
X
Welcome to:polala.com
Web Design | Video Games | RVs | Religion | Management | Supplements and Vitamins | Software | Basketball | Related articles
Search:  
NAVIGATION: Home >>

C++programming

Published by: mike 2010-03-19

  • please have a go at compiling this program thats all i want. iam using a c++borland 5.5 #include using std::cout; using std::cerr; using std::cin; using std::endl; using std::ios; #include using std::ofstream; using std::ostream; using std::fstream; #include using std::setiosflags; using std::resetiosflags; using std::setw; using std::setprecision; #include #include "clntdata.h" int enterchoice(0; void textfile ( fstream& ); void updaterecord( fstream& ); void newrecord( fstream& ); void deleterecord( fstream& ); void outline ( ostream&, const clientdata &); int getaccount9 const char * const ); enum choices { textile =1, update, new, delete, end }; int main() { fstream inoutcredit( "credit.dat", ios::in / ios::out); if (!inoutcredit) { cerr <<"file could not be opened."<>menuchoice; return menuchoice; } // create formatted text file for printing void textfile ( fstream &readfromfile ) { ofstream outprintfile( "print.txt", ios::out ); if ( !outprintfile ) { cerr << "file could not be opened." <( &client), sizeof (clientdata)); while ( !readfromfile.eof()){ if(client.accountnumber !=0) outputline(outprintfile, client ); readfromfile.read (reinterpret_cas( &client), sizeof (clientdata)); } } //update an account's balance void updaterecord ( fstream &updatefile ) { int account = getaccount ( "enter account to update" ); update file.seekg(( account - 1) * sizeof (clientdata)); clientdata client; updatefile.read (reinterpret_cast( &client), sizeof( clientdata)); if (client.accountnumber !=0){ outputline( cout, client); cout<<"nenter charge (+) or payment (-):"; double transaction ; //charge or payment cin >>transaction; //should validate client.balance +=transaction; outputline(cout, client); updatefile.seekp((account-1) *sizeof (clientdata)); updatefile.write( reinterpret_cast(&client), sizeof(clientdata)); } else cerr<<"account#"<(client), sizeof(clientdata)); if(client.accountnumber == 0) { cout<< "enter lastname, firstname, balancen?"; cin>>client.lastname >>client.firstname >>clientbalance; client.accountnumber =account; insertinfile.seekp((account-1)* sizeof(clientdata)); insertinfile.write( reinterpret_cast(&client), sizeof(clientdata)); } else cerr<<"account#"<(&client), sizeof(clientdata)); if(client.accountnumber !=0) { clientdata blankclient={0, "","", 0.0}; deletefromfile.seekp((account-1)* sizeof(clientdata)); deletefromfile.write( reinterpret_cast( &blankclient ), sizeof(clientdata)); cout<<"account #" <>account; }while (account 1account > 100); return account; }


  • Hello Integrated, Are you looking for guidance in fixing all the compilation errors? For example (line #:comment) 25: replace 0 with ) 33: textfile, new, delete are already defined, try xtextfile, xnew, xdelete as enumeration values 37: replace / (divide) with bitwise inclusive or 48: replace textfile with xtextfile 54: replace new with xnew 57: replace delete with xdelete 99: replace <, with << 101: replace <, with << and so on for the simple syntax errors. There are a number of other problems such as undefined variables and so on. Do you need help on fixing all these or something more comprehensive (e.g., help in writing some of the other functions)? Also, you should supply clntdata.h to get a complete answer. --Maniac
  • C programming course::
    (i.e., try to solve the example C programming tasks given in lectures). The only way to learn a programming language is to practice!
    http://www.phys.unsw.edu.au/~mcba/c001.html
    HOME
    C++ ebook, c++ programming » Download Free Computer Ebooks - NET BOOKS::
    Programming 8-bit PIC Microcontrollers in C: with Interactive Hardware Do you want a low cost way to learn C programming for microcontrollers?
    http://www.netbks.com/category/programming/c-c-programming
    HOME


  • Hello, integrated: Do you want the resulting executable? Regards.
  • The C Library Reference Guide::
    The C Library Reference Guide. by Eric Huss © Copyright 1997 Eric Huss 1.3.1 Definition 1.3.2 Program Startup 1.4 References 1.4.1 Pointers and the
    http://www.acm.uiuc.edu/webmonkeys/book/c_guide/
    HOME


  • joseleon-ga yes thats right i need the program to be fully compiled. maniac-ga yes i do need all the errors fixed > other functions that needs to be written come later i will let u know thanks guys intergrated


  • maniac- i forget to mention that 5.) display summary reports for all the accounts 6.)exit program thanks integrated


  • Hello Integrated, OK. I have a clean compile. For reference, I created clntdata.h as struct clientdata { int accountnumber; char * lastname; char * firstname; double balance; }; It is good enough to get a clean compile, but is obviously not correct since the program does not work properly (bus error when trying to add an account). I ask again - please post a copy of your clntdata.h as a clarification. I will make sure the code will compile cleanly with your file. I will also try some basic tests and fix any obvious problems. I will then post the revised code as the answer and explain the changes so you can understand the steps I took to get there. --Maniac


  • maniac - i have send a program which i have made in pascal and i wanted to convert it into C++ with the following features that i have numbered underneath. a C++ program where a customer can invest in a number of different account types.withdraw and deposit money into the account as many as they wish in a day. lets say : friendly welcome screen 1.) savings account i only want three types of account 2.) current account 3.) current plus -------------------- 3.) withdraw 4.) deposit ----------------------- 5.)friendly exit program PROGRAM BankInt; (*by Shiv Kapoor*) Uses WinCrt; Const FIVE = 5; SEVEN = 7; TEN = 10; TWELVE = 12; Message = 'KTC Banking System'; TYPE AccRec = RECORD Names : string[15]; AcctNo : string[10]; AccType : char; Amount : real; NewBal : real; END; List = Array[1..20] of accRec; VAR select : char; customers : List; ListEnd : integer; EndMessage : char; (******************************************************************) PROCEDURE Keypress; Begin gotoxy(10,25); Write('To continue press ENTER...'); ReadLn; End; (******************************************************************) PROCEDURE Menu(VAR select : char); BEGIN ClrScr; gotoxy(28,1);WriteLn(Message); gotoxy(28,3);WriteLn('Customers Record'); gotoxy(15,4);WriteLn('=========================================='); WriteLn('1. Input customers details'); WriteLn('2. Display accounts details'); WriteLn('9. EXIT'); gotoxy(25,10);Write('Select from one of the above options '); ReadLn(select); END; (*******************************************************************************************************) PROCEDURE Calculate(VAR customers:List; VAR ListEnd:integer); VAR i: integer; {Local Variable} BEGIN FOR i :=1 to ListEnd DO BEGIN WITH Customers[i] DO BEGIN CASE AccType OF 'S' : IF Amount < 5000 THEN NewBal := Amount + (Amount * TEN/100) ELSE NewBal := Amount + (Amount * TWELVE/100); 'C' : IF Amount < 100 THEN NewBal := Amount + (Amount * FIVE/100) ELSE NewBal := Amount + (Amount * SEVEN/100); END; END; END; END; (*********************************************************************************************************) PROCEDURE Input(VAR customers:List; VAR ListEnd:integer); VAR choice : char; {Local variable} BEGIN REPEAT {Repeat until user type 'N'} ListEnd:=ListEnd+1; WITH Customers[ListEnd] DO BEGIN WriteLn('Customers Details'); WriteLn('================='); Write('Account holders name =====> '); ReadLn(Names); Write('Account number ===========> '); ReadLn(AcctNo); Write('Account type (C or S) ====> '); ReadLn(Acctype); Write('Amount ===================> '); ReadLn(Amount); End; Repeat WriteLn('Enter another customer? (Y/N)'); ReadLn(choice); Until (Choice in ['N','Y']); UNTIL Choice ='N'; {Repeat until types 'N'} Calculate(Customers, ListEnd); END; (********************************************************************************************************) PROCEDURE Display(VAR customers:List; VAR ListEnd:integer); VAR i: integer; BEGIN IF ListEnd > 0 THEN BEGIN ClrScr; gotoxy(25,2);WriteLn('===================='); gotoxy(25,3);WriteLn('STATEMENT OF ACCOUNT'); gotoxy(25,4);WriteLn('===================='); WriteLn; WriteLn('Account name':16, 'Acct No.':11, 'A/C Type':10, 'Old Balance':15, 'New Balance':15); WriteLn('------------':16, '--------':11, '--------':10, '-----------':15, '-----------':15); FOR i := 1 TO ListEnd DO BEGIN WITH Customers[i] DO {change i was ListEnd} BEGIN WriteLn(Names:16,AcctNo:11,AccType:8,Amount:15:2,NewBal:15:2); END; {of WITH} END; {of FOR } WriteLn END ELSE BEGIN Writeln('No Accounts in the system'); END; Keypress; END; (************************************************************************************************************) BEGIN {of main program} ListEnd := 0; REPEAT Menu(select); CASE select OF '1' : Input (customers, ListEnd); '2' : Display(customers, ListEnd); END; UNTIL select ='9'; gotoxy(23,25);WriteLn('Thanks for using KTC banking system'); ReadLn(EndMessage); END. (*********************************************************************************** Ps. forget about the program that i have posted yesterday totally have a crack at this one for me please





  • Where's The Advantage In Windows Genuine Advantage?
    Stocks Bounce After S&P Joins Bear Market

    You are looking at:polala.com's C++programming, click polala.com to home

    Recent articles

  • do you think we will start to see more atheist black people in the coming years
  • christians why didn 039 t god just prevent the birth of the drowned flood babies to avoid causing them pain
  • any arguements for why athiesm requires more faith than christianity
  • what are you thankful for
  • fundie christians why do you think that theocracy is okay as long as its your beliefs
  • i 039 m scared of when my time runs out on this earth i 039 m scared of eternity because it 039 s so out of this world
  • christians is there any contradiction that you cannot rationalize
  • why is it that when someone reads spanish speaking they automatically think mexican
  • im bi and like my best friend nikki is straight until she told me she isnt
  • hey christians please answer
  • seniors do u think a little bit of mild humour with a question is out of order
  • who or what is beowulf in greek mythology
  • would you like to see the end of the world
  • why didn 039 t the bible simply list which things aren 039 t sins and leave it at that

  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about C++programming , Please add it free.
     Homepage | Add to favorites | Contact us | Exchange links | LOGIN | Site map | 
    Copyright© 2008 polala.com        Site made:CFZ