Author |
Message |
Nikola

|
Posted: Sat Jun 21, 2008 4:03 pm Post subject: Callback help! |
|
|
I am making a program that consists of a login area first and a menu second. Once an option is picked from the menu i want to have the option of going back to the menu but the only thing i can do right now is make it start all over which means going back to the login as well. Can anyone help? Thanks  |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Richard Knop

|
Posted: Sat Jun 21, 2008 5:18 pm Post subject: RE:Callback help! |
|
|
I'm not sure I understand what you mean.
Anyways close the menu with other content in one big loop ("while" probably the most suitable) and set some suitable condition. That's how these menus work most of the time... |
|
|
|
|
 |
BigBear
|
Posted: Sat Jun 21, 2008 9:51 pm Post subject: Re: Callback help! |
|
|
So you have loop of login.
Loop for main menu (which will have other loops inside)
then when you exit one of the loops inside of the main menu loop it will remain in the main menu loop and return to the main menu. |
|
|
|
|
 |
Nikola

|
Posted: Sun Jun 22, 2008 12:27 pm Post subject: Re: Callback help! |
|
|
Here is the code. I hope this helps!
Username: admin
Password: admin
*Case Sensitive*
code: | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
int main()
{
char c[10];
FILE *file;
char str_username [40];
char str_password [40];
int int_ctr = 0;
int int_options = 0;
char str_sendmail[400];
int int_options2;
char str_mailto[50];
char str_subject[50];
while(int_ctr <= 1)
{
printf("Email Login\n");
printf("Username: ");
scanf(" %s", str_username);
printf("Password: ");
scanf(" %s", str_password);
system ("CLS");
if(!strcmp(str_username,"admin") && !strcmp(str_password,"admin"))
{
printf("Welcome\n");
int_ctr = 2;
printf("What would you like to do first?\n");
printf("1. Read Inbox\n2. Read Junk Mail\n3. Send Email\n");
scanf(" %d", &int_options);
}
else
printf("Wronge Password! \nTry Again\n\n");
}
system ("CLS");
if(int_options == 3)
{
printf("To: ");
fflush(stdin);
gets(str_mailto);
printf("Subject: ");
fflush(stdin);
gets(str_subject);
printf("Please enter email: ");
fflush(stdin);
gets(str_sendmail);
system ("CLS");
printf("Email Sent!\n");
printf("What would you like to do now?\n1. Logout\n2. Back To Menu\n");
scanf(" %d", &int_options2);
}
if(int_options == 1)
printf("not done yet");
printf("Not done yet");
scanf(" %d", int_options);
if(int_options2 == 1)
{
system ("CLS");
printf("Closing");
Sleep(400);
printf(".");
Sleep(400);
printf(".");
Sleep(400);
printf(".\n");
Sleep(400);
printf("GoodBye!\n");
system("PAUSE");
return 0;
}
system("PAUSE");
return 0;
}
|
Download EXE:
http://proxycop.info/code/Summative.exe |
|
|
|
|
 |
Nikola

|
Posted: Sun Jun 22, 2008 11:31 pm Post subject: RE:Callback help! |
|
|
I still really need help with this guys! |
|
|
|
|
 |
|