SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 305 Weeks Ago, 1 Day Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 12 Dec 2017 My Price 10.00

/Preprocessor directive #include outputting the desired balance

Hello, I'm having trouble with getting the arrays to match with the input, and outputting the desired balance, etc.


  • //Preprocessor directive
    #include<iostream>
    #include<conio.h>
    #include<fstream> //step1


    #include<iomanip>
    using namespace std;

    //global variables, global constants, function prototypes
    ifstream fin; //global variable

    void headerfn(); //headerfn prototype

    void inputfn(int pin[3], string firstname[3], float balance[3]);
                
    void outputfn(int pin[], string firstname[3], float balance[3]);          

    int m;


    int i=0;

    int ch;

              

    int main(){ 
        //start of block in main
       
        //declare the string and integer arrays
        int pin[3];
        string firstname[3];
        float balance[3];
       
        ifstream fin;
      
        double withdraw;
        double deposit;

        headerfn();
       


        inputfn(pin, firstname, balance);

        outputfn(pin,firstname, balance);

       
        fin.open("pin.txt");
       
        if(!fin){
                 cout<<"Input failure\n";
                 cout<<"Press any key to continue\n";
                 getch();
                 return 1;
                 }//end of fin error check end step3
                
        while(!fin.eof()){
            fin>>firstname[3];
            firstname[3]=firstname[m];
            fin>>pin[3];
            pin[3]>>pin[m];
            fin>>balance[3];
            balance[3]>>balance[m];
            m++;
    }
        fin.close();
    }

       


        do{
        cout<<"*****************************************************"<<endl;
        cout<<"* Credit Union    *"<<endl;
        cout<<"*****************************************************"<<endl;
         cout<<"Please enter your PIN: ";
         cin>>pin[m];
         int ch;
       
        for(m=0;m<1;m++)
            {
                cout<<firstname[m]<<", Please select from the following options:"<<endl;
                    cout<<"Please press 1 to view your balance"<<endl;
                cout<<"2 to deposit"<<endl;
                cout<<"3 to withdraw"<<endl;
                cout<<"4 to exit"<<endl;
                cin>>ch;
            while(ch !=4){
           
                switch (ch)    {
                case 1:
                    cout<<"Your current balance is: "<<balance[m];
                    cout<<endl;
                      cout<<"Press any key to try again or exit ";
                      cout<<endl;
                      getch();
                    break;
                   
                case 2:
                    cout<<"Please enter the deposit amount: ";
                    cin>>deposit;
                    balance[m]=balance[m]+=deposit;
                    cout<<"Your updated balance is "<<deposit;
                    cout<<endl;
                    cout<<"Press any key to try again or exit";
                    cout<<endl;
                    getch();
                    break;
                   
                case 3:
                    cout<<"Please enter the withdrawal amount: ";
                    cin>>withdraw;
                    balance[m]=balance[m]-withdraw;
                    cout<<"Your updated balance is "<<balance[m];
                    cout<<endl;
                    cout<<"Press any key to try again or exit";
                    cout<<endl;
                    getch();
                    break;
                   

                            }
                    }
                }
    }while(ch !=4);
       
    system("pause");
    return 0;}


    //*****************************************************;
    void headerfn(){
        cout<<"*****************************************************"<<endl;
        cout<<"* Programmer:  Rebecca                              *"<<endl;              
        cout<<"*****************************************************"<<endl;
         cout<<" You have successfully entered the information"<<endl;
         cout<<endl;
         cout<<left<<setw(10)<<"PIN"<<left<<setw(10)<<"NAME"<<right<<setw(10)<<"Balance"<<endl;
              }//end of headerfn

    //*****************************************************
    void inputfn(int pin[3], string firstname[3], float balance[3])
    {     for(int row=0; row<3; row++)
            fin>>pin[row]>>firstname[row]>>balance[row];      
                    
                    
                     }//end of inputfn

    //*****************************************************
    void outputfn(int pin[3], string firstname[3], float balance[3]){

        
         cout<<fixed<<showpoint<<setprecision(2);
        
         for(int row=0; row<3; row++)
            cout<<left<<setw(10)<<pin[row]
                <<left<<setw(10)<<firstname[row]
                <<right<<setw(10)<<balance[row]
                       <<endl;           
                     }//end of outputfn
    //*****************************************************



Attachments:

Answers

(5)
Status NEW Posted 12 Dec 2017 07:12 AM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)