when converting iget erros especially in the cin parts because they are automatically passed by something

#include<iostream>
#include<conio.h>
#include<math.h>

using namespace std;

int p=1;


class Bank

    {
          public:
    char name[50],address[90],type;
    double ein_betrag, aus_betrag;
    double balance;
    int costumernr, accountnr, birth, tel;
    public:
          void newcostumer();     
          void newaccount();      
          void costumerdel();     
          void accountdel();      
          void deposit();    
          void withdraw();
          void accountinfo();
};

void Bank::newcostumer()


    { 

         cout<<"\n Enter your name : " << endl;
         cin>>name;
         cout << " Enter your address: " << endl;
         cin >>address;
         cout << " your tel nr please: " << endl;
         cin >>tel;
         cout << " Enter your gebdatum: " << endl;
         cin >>birth;
         cout<<"\n Enter your type of account :\n s for SAVING account \n f for FIXED account : ";
         cin>>type;
         cout<<"\nEnter your starting balance : "<< endl;
         cin>>balance;
         if(balance<10)


        {
        cout<<" The minimum balance is Euro 10";
    }

    accountnr=1000+p;
    cout<<" Your account number is : "<<accountnr<<" Always remember it";
}
void Bank::costumerdel() {
        costumernr = 0;
        birth = 0;
        tel = 0;
        address[90] = 0;
}
void Bank::accountdel() {
        accountnr = 0;
        balance = 0;

        };
void Bank::deposit()


    {

    unsigned long int x;
    cout<<"\nEnter the amount to be deposited : ";
    cin>>x;
    balance=balance+x;
    cout<<"\n Your new balance is : Euro "<<balance;
}

void Bank::withdraw()


    {

    unsigned long int x;
    cout<<"\n Your balance is : "<<balance;
    if(type=='s')


        {
        cout<<"\nenter the amount to be withdrawn : ";
        cin>>x;
        if( x<=(balance-10))


            {
            balance-=x;
            cout<<"\nNew account balance is : "<<balance;
        }

        else


            {
            cout<<"\n Not possible for you ";
        }

    }

    else
    cout<<"\n NOT possible for you ";
}

void Bank::accountinfo()


    {
    cout<<"\n Hello "<<name<<" Your account balance is : "<<balance;
}

int main()


    {

    char ch;int n,x;
    Bank e[100];
    star:cout<<"\n Are you a new user(y/n) : \n Press x To go out of system";
    cin>>ch;
    if(ch=='y'||ch=='Y')


        {
        e[p].newcostumer();
        p++; getch();

        goto star;
    }

    else


        {
        if(ch=='x'||ch=='X')


            {
            goto end;
        }

        else
        cout<<"\n Enter your account no. : ";
        cin>>n;
        n-=1000;
        if(n>0)


            {
            cout<<"\n Enter your choice \n 1.New Account \n 2.Costumer delete \n 3.Account delete \n 4.deposit \n 5.Withdrawal \n 6.Transaction \n 7.Check your account\n 8.exit \n 9.To go out of system:";
                cin>>x;
            while(x!=8)


                {
                switch(x)


                    {
                    case 1:
                    e[n].newcostumer();break;
                    case 2:
                    e[n].costumerdel();break;
                    case 3:
                    e[n].accountdel();break;
                    case 4:
                    e[n].deposit();break;
                    case 5:
                    e[n].withdraw();break;
                    case 6:
                    e[n].transaction();break;
                    case 7:
                    e[n].accountinfo();break;
                    case 9:
                    goto end;
                    default:
                    cout<<"\nInvalid";
                }

                cout<<"\n Enter your choice \n 1.New Account \n 2.Costumer delete \n 3.Account delete \n 4.deposit \n 5.Withdrawal \n 6.Transaction \n 7.Check your account\n 8.exit \n 9.To go out of system:";
                cin>>x;
            } goto star;

        }

        else
        cout<<"\nInvalid";
    }end:;

}

Recommended Answers

All 2 Replies

Hi shadowplayer28,
I do not know why you gave the title like that. But this program can be fixed I think. I see you can the function transaction(), but I cannot see it in the decleration part, like this,

public:
void transaction();

And where the functin is implemented.
Correct:

public:
...
void transaction();
...

void Bank::transaction()
{;}

I already tested the program, that's fine. I used g++ as the compiler (g++ -o main.exe main.cpp).
Hope it helps!

Edward_3: I think you missed the point. The OP needs a C program, and cannot use the C++ version, for whatever reason s/he has.

shadowplayer28: Just what are you trying to accomplish by re-writing the program in C? Why do you need it to be in C, and not in C++? Is this your original code, or something you found on the net, and if the latter, are you certain it is really what you need? Do you know both languages, and do you understand the ways they differ and why?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.