>and i do need to know how to declare clrscr();
This is unnecessary.
All your problems would be solved if you drew a flow chart to summarise your problem. Have you done this?
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
It is better if you use characters for the menu instead of numbers.
Here it is the skeleton of a menu you can use. I made use of the first character of every option as the one the user can choose from.
#include <stdio.h>
#include <ctype.h>
#define FALSE 0
#define TRUE !FALSE
int main( void )
{
int c;
int done = FALSE;
while( !done )
{
puts("\nMENU SCREEN\n");
puts("W - Withdraw\n");
puts("B - Balance Enquiry\n");
puts("C - Change Password\n");
puts("Q - Quit\n");
fputs("Select a choice: ", stdout );
fflush( stdout );
c = getchar();
c = toupper( c );
switch( c )
{
case 'W':
/* do something here */
break;
case 'B':
/* do something here */
break;
case 'C':
/* do something here */
break;
case 'Q':
done = TRUE; /* Exit here */
break;
default:
puts( "Wrong input, choose again" );
break;
}
}
}
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218
1. from there i dont know how to save the balance into the source code...
2. i cant keep the info in a file cozzz my assignment doesnt let me do it....
3. without saving the info in a file how to save the new balance so tat when i open again the balance is 1000 or should it b done by saving the balance into file......
4. if save it into a file... how to do it?
1. There 2 basic requirements for storage, A) Temporary B) Persistent.
- Temporary can be achieved using teh structures or arrays or variables (depending on what you wanna store). This would remain in the program memory and be wiped off when you restart your program.
- Persistent can be achieved using many ways e.g. file, database, tape-drive, shared-memory (NOT same as program memory) etc. Again what you choose depends on requirements. E.g. shared memory is very fast, whereas DB will provide you all kind of querying so you don't have to write code for that.
2. If this is the case it's clear that you don't have a requirement to keep data persistently. So go ahead and use one of the temporary methods. I would suggest use a structure.
3. Think a li'l on how to keep data in structures and you'll figure this out.
4. Do you want/need to store data in file or not ?
thekashyap
Practically a Posting Shark
811 posts since Feb 2007
Reputation Points: 254
Solved Threads: 75