| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
General - Atm operation
can please someone correct this code.
#include<iostream.h> #include<conio.h> void main() { char indent; Savings saving[3]; Checking check[3]; Account accoun[3]; int num=1001; float moo; for(int x=0;x<3;x++) { cout<<"\t\t*****This IS THE ACCOUNT NUMBER: "<<num<<"*****"<<endl; cout<<"Please enter the type of transaction you want(c-checking and s-savings)"; cin>>indent; cout<<endl; switch(indent) { case 'c': { cout<<"Enter monthly amount "; cin>>moo; accoun[x].set(num,moo); check[x].set_ch(); break; } case 's': { cout<<"Enter monthly amount "; cin>>moo; accoun[x].set(num,moo); saving[x].set_in(); break; } default: { cout<<"*******you entered the wrong data********\n" ; } } num++; } cout<<"++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++"; for(int k=0;k<3;k++) { accoun[k].display(); saving[k].display_savings(); check[k].display_checking(); } getch(); } |
|
#2
|
||||
|
||||
|
It is correct until you say what you want to happen that doesn't.
A couple tips: <iostream.h> is obsolete where found, Visual C++ doesn't provide it anymore as of 2010 betas. Use <iostream> instead. You may have to use using namespace std; or equivalent. You're trying to use the types (classes) "Savings", "Checking", "Account" without defining them. If they were defined in another file, you need to include that file. In the absense of a description of what is proper program behavior, making arrays of them looks like a mistake to me.
__________________
Quote:
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > General - Atm operation |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|