GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 02-Sep-2005, 22:19
meepok meepok is offline
New Member
 
Join Date: Aug 2005
Posts: 16
meepok is an unknown quantity at this point

back to page


CPP / C++ / C Code:
void add_user(void)
{
int go = 1;
char ask;
while(go == 1)
	{
		if (entered == MAX_USER)
		{
			cout << "\tUser entry is full!";
			go = 0;
		}
		else
		{
			cout <<"Enter Pin:" << endl; 
			cin >> user_pin[entered];
			cin.ignore(2,'\n');

			cout <<"Enter Start Time:" << endl; 
			cin >> user_starttime[entered];
			cin.ignore(2,'\n');
			
			cout <<"Enter Stop Time:" << endl; 
			cin >> user_stoptime[entered];
			cin.ignore(2,'\n');
			
			cout <<"Enter Expiry Date:" << endl; 
			cin >> user_expirydate[entered];
			cin.ignore(2,'\n');
			entered++;
			
			cout << "\tContinue with next entry [Y/N]?";
			cin >> ask;
			cin.ignore(2,'\n');
			cout << endl;
			if( ask == 'N' || ask == 'n')
			{
 		display_menu();			                          }
	
		}
	}
}

i dun know wats the problem... i cant get to the display_menu page.
Last edited by admin : 03-Sep-2005 at 02:28. Reason: Please insert your C code between [c] & [/c] tags
  #2  
Old 03-Sep-2005, 00:27
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,234
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Neither do we. No one explained it to us. Please read the Guidelines. Pay close attention to #1, #2, #3
__________________

Cow: You're a lawyer too?
Mooseblood (mosquito): Ma'am, I was already a bloodsucking parasite. All I needed was a briefcase!
  #3  
Old 03-Sep-2005, 11:43
blank blank is offline
Junior Member
 
Join Date: May 2005
Posts: 39
blank is on a distinguished road
Yeah dude, show us all the code, all the code that's needed at least.
  #4  
Old 04-Sep-2005, 01:03
meepok meepok is offline
New Member
 
Join Date: Aug 2005
Posts: 16
meepok is an unknown quantity at this point

help on project.


CPP / C++ / C Code:
/***************************************************
IT1733 Mini Project : <Card Reader>
Name : Chong Xianliang
Admin No : 056175E
Module Group : IT7113
****************************************************/
#include <iostream>
#include <process.h>
using namespace std;
#define MAX_USER 99

/* global variables */
int user_ID[MAX_USER];
int user_pin[MAX_USER];
int user_starttime[MAX_USER];
int user_stoptime[MAX_USER];
int user_expirydate[MAX_USER];
int go = 1;
int checkid;
int entered = 0;

/* function prototypes */
void display_menu(void);
void system_configuration(void);
void operation_mode(void);
void report_generation(void);
void shutdown(void);
void cardid_configuration(void);
void add_user(void);
void blacklist_configuration(void);
void enter_user_info(void);
void modify_user_info(void);
void del_user_info(void);
void pause(void);

void main(void)
{
	int choice;
	while(go == 1)
	{
		system("cls");
		display_menu();
		cin >> choice;
		system("cls");
		cin.ignore(2,'\n');
		if(choice == 1)
		{
			system_configuration();			
		}
		else if(choice == 2)
			{
				operation_mode();
			}
			else if(choice == 3)
				{
					report_generation();
				}
				else if(choice == 4)
					{
						shutdown();
					}
					else
						{
							cout <<"\tInvalid Choice!" << endl;
							pause();
						}
	}
}

void display_menu(void)
{
cout <<"\t SECURETECH PTE LIMITED" <<endl;
cout <<"\t ======================" <<endl << endl;
cout <<"1. System Configuration" << endl;
cout <<"2. Operation Mode" << endl;
cout <<"3. Report Generation" << endl;
cout <<"4. Shut Down" << endl;
cout <<"Enter Choice:";
}

void system_configuration(void)
{
int config_choice;
int go = 1;
cout <<"\t SYSTEM CONFIGURATION" <<endl;
cout <<"\t ====================" <<endl << endl;
cout <<"1. Card IDs" << endl;
cout <<"2. Black List" << endl;
cout <<"3. Exit" << endl;
cout <<"Enter Choice:";
cin >> config_choice;
system("cls");
while(go == 1)
	{
	if(config_choice == 1)
		{
			cout << "Enter Card ID:";
			cin >> checkid;
			cardid_configuration();
		}
	else if(config_choice == 2)
			{
				cout <<"Black List Not Required" << endl;
				go = 0;
			}
		else if(config_choice == 3)
				{
					go = 0;
				}
			else 
				{
					cout << "Invalid Choice" << endl;

				}
	}
}
void operation_mode(void)
{
int count = 0;
int ID;
int Pin;
cout <<"\t OPERATION MODE" <<endl;
cout <<"\t ==============" <<endl;
cout <<"Enter Card ID:" << endl;
cin >> ID;
cout <<"Enter Pin:" << endl;
cin >> Pin;

 /* do */
}

void report_generation(void)
{
	while(go == 1)
	{
		cout <<"\t Transaction Report Not Required" <<endl;
		go = 0;
	}
}

void cardid_configuration(void)
{
int idconfig_choice;
int count = 0;

cout <<"\t Card ID Configuration" <<endl;
cout <<"\t =====================" <<endl << endl;
cout <<"1. Add" << endl;
cout <<"2. Delete" << endl;
cout <<"3. Modify" << endl;
cin >> idconfig_choice;
system("cls");
if(idconfig_choice == 1) 
{
	if(checkid != user_ID[entered])
		{
			add_user();
		}
		else
				{
					cout << "Error" << endl;
				}
}	
else if(idconfig_choice == 2)
		{
			cout <<"do" << endl;
		}
	else if(idconfig_choice == 3)
			{
				cout <<"do" << endl;
			}
		else 
			{
				cout << "Invalid Choice" << endl;
			}

}
void add_user(void)
{
int go = 1;
char ask;
while(go == 1)
	{
		if (entered == MAX_USER)
		{
			cout << "\tUser entry is full!";
			go = 0;
		}
		else
		{
			cout <<"Enter Pin:" << endl; 
			cin >> user_pin[entered];
			cin.ignore(2,'\n');

			cout <<"Enter Start Time:" << endl; 
			cin >> user_starttime[entered];
			cin.ignore(2,'\n');
			
			cout <<"Enter Stop Time:" << endl; 
			cin >> user_stoptime[entered];
			cin.ignore(2,'\n');
			
			cout <<"Enter Expiry Date:" << endl; 
			cin >> user_expirydate[entered];
			cin.ignore(2,'\n');
			entered++;
			cout << "\tContinue with next entry [Y/N]?";
			cin >> ask;
			cin.ignore(2,'\n');
			cout << endl;
			if( ask == 'N' || ask == 'n')
			{
				display_menu();
				
			}
	
		}
	}
}
void pause()
{
char tmp;
cout << endl << "\tPress ENTER to continue...";
cin.get(tmp);
} 

void shutdown(void)
{
int password;

cout <<"\t SHUT DOWN" <<endl;
cout <<"\t =========" <<endl << endl;
cout <<"Enter Password:" << endl;
cin >> password;
while(go == 1)	
{	
	if(password == 0)
		{
			cout <<"Exiting..." << endl;
			go = 0 ;
		}
	else
		{
			cout <<"Incorrect Password" << endl;
			go = 1;
		}
}

}

how do i go to the display_menu page after i enter a user data?
Last edited by admin : 04-Sep-2005 at 07:56. Reason: Please insert your C++ code between [c++] & [/c++] tags
  #5  
Old 04-Sep-2005, 07:51
Zorachus's Avatar
Zorachus Zorachus is offline
Junior Member
 
Join Date: Jul 2005
Posts: 58
Zorachus will become famous soon enough
Before posting, make sure that you put [c++] and [/c++] tags before and after your code. Otherwise, we can't read it, and we can't be of much help.
__________________
Pursue everything!

P.S. This is what you would get at some point in the alphabet with the removal of the Q and R.
  #6  
Old 04-Sep-2005, 09:55
Sokar Sokar is offline
Member
 
Join Date: May 2005
Posts: 243
Sokar has a spectacular aura aboutSokar has a spectacular aura about
Quote:
Originally Posted by meepok
how do i go to the display_menu page after i enter a user data?
I am not sure what you are asking. You will need to more specific.

Example Question:
When I am done in my function "add_user" how can I get back to the calling function.

One Solution :
If you call "return" from a void function(like add_user) that will cause the function to stop execution and return to the calling function
(cardid_configuration).

So if you change this "if" statement from "add_user",
CPP / C++ / C Code:
if( ask == 'N' || ask == 'n')
   {
      display_menu();  
   }
to,
CPP / C++ / C Code:
if( ask == 'N' || ask == 'n')
   {
      return;  
   }
You will end up back in "cardid_configuration".
  #7  
Old 04-Sep-2005, 11:23
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,234
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
For someone that would like help, you seem to be ignoring some of that help, which, I repeat, is:
Quote:
Originally Posted by WaltP
Neither do we. No one explained it to us. Please read the Guidelines. Pay close attention to #1, #2, #3
Don't pick and choose our responses.
Please read the Guidelines. Pay close attention to #1, #2, #3


Quote:
Originally Posted by Zorachus
Before posting, make sure that you put [c++] and [/c++] tags before and after your code. Otherwise, we can't read it, and we can't be of much help.
Let's get the other guidelines too, as I mentioned before you. He needs more that just code tags...
__________________

Cow: You're a lawyer too?
Mooseblood (mosquito): Ma'am, I was already a bloodsucking parasite. All I needed was a briefcase!
 
 

Recent GIDBlogToyota - 2008 July Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Page Rank vs. Google listing crystalattice Search Engine Optimization Forum 8 15-Mar-2007 03:49
Loading a php page in an iframe from javascript Clive73 Web Design Forum 0 18-May-2005 06:10
next page skyloon MySQL / PHP Forum 5 17-Oct-2004 12:04
[script] E-mail webmaster error page BobbyDouglas PHP Code Library 0 19-Aug-2003 20:10
Search Engine Positioning 101 and 201 "How To" Tips... 000 Search Engine Optimization Forum 0 29-May-2003 10:34

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 21:40.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.