Thursday, December 11, 2008

My Final Project in CSC 122

#include
#include
#include

char log,sign,a;
int x,c,m,z[20];
int choice;

int main()
{

char pass[30];
char filename[30];
int balik=1;
char line1[20];
char line2[20];
char line3[20];
char line4[20];
char line5[20];
char line6[20];
int code;
char fid[20];
char fpass[20];
FILE *f;


printf("sign-in to YAHOOMAIL!\n");
printf("you are protected\n\n");
system("pause");


while(balik==1)
{
printf("enter ID:");
gets(filename);
///1
if((f=fopen(filename,"r"))!=NULL)
{
printf("error! ID exist!\n");

balik=1;
}

///1
else
{
///2
if((f=fopen(filename,"w"))==NULL)
{
printf("error ID\n");
balik=1;
}
//2
else
{


//information center

f=(fopen(filename,"w"));
printf("last name:");
gets(line1);
fprintf(f,"last name:%s\n\n",line1);


printf("first name:");
gets(line2);
fprintf(f,"first name:%s\n\n",line2);


printf("middle name:");
gets(line3);
fprintf(f,"middle name:%s\n\n",line3);


printf("age:");
gets(line4);
fprintf(f,"age:%s\n\n",line4);


printf("gender:");
gets(line5);
fprintf(f,"gender:%s\n\n",line5);


printf("Email Address:");
gets(line6);
fprintf(f,"Email Address:%s\n\n",line6);
fclose(f);

printf("PASSWORD:");
scanf("%s",pass);
f=(fopen(pass,"a"));
fclose(f);

ret:
printf("\n\nJust a couple more details...\n Type the code shown\n\n");
printf("do not input character!\n\n");
printf(" __________________\n");
printf("| |\n");
printf("| 2253028 |\n");
printf("|__________________|\n\n");


printf("type the codes:");
scanf("%d",&code);
///3
switch (code)

{
///3
case 2253028:
printf("\n\nsuccessfully signed\n\n");
system("pause");
goto alog;
///3
case 2:
printf("error");
system("cls");
goto ret;
///3
default:
system("cls");
goto ret;
}
alog:
system("cls");
for (m=0;m<=44;m++) printf("%d",m); printf("\n\n\n\n\n\n\n\n\n\n\n\t\t\t\tlog-in?[y/n]:"); scanf("%s",&log); ///4 switch (log) { ///4 case 'y': { final: system("cls"); printf("enter ID:"); scanf("%s",fid); printf("enter PASSWORD:"); scanf("%s",fpass); ///5 if ((strcmp(fid,filename)==0)&&(strcmp(fpass,pass)==0)) { main: system("cls"); printf("\n\n\n\n\n view account[1]\n\n"); printf("military time [2]\n\n"); printf("log-out [3]\n\n\n\n\n"); printf("enter your choice:"); scanf("%d",&choice); switch (choice) { case 1: { system("cls"); f=(fopen(filename,"r")); fgets(line1,20,f); fgets(line2,20,f); fgets(line3,20,f); fgets(line4,20,f); fgets(line5,20,f); fgets(line6,20,f); printf("your account:\n\n"); puts(line1); puts(line2); puts(line3); puts(line4); puts(line5); puts(line6); system("pause"); goto main; break; } case 2: { system("cls"); printf("enter your name:"); scanf("%s",z); printf("hello %s have fun! enjoy...\n\n",z); printf("enter your military time:"); scanf("%d",&x); /*ACAS ARNEL M.*/ if(x==1300) { printf("1:00 pm"); system("cls"); system("pause"); goto main; } if((x>=1301)&&(x<=1399)) { c=x-1300; printf("1:%dpm",c); system("pause"); goto main; } if(x==1400) { printf("2:00 pm"); system("pause"); goto main; } if((x>=1401)&&(x<=1499)) { c=x-1400; printf("2:%d pm",c); system("pause"); goto main; } if(x==1500) { printf("3:00 pm"); system("pause"); goto main; } if((x>=1501)&&(x<=1599)) { c=x-1500; printf("3:%d pm",c); system("pause"); goto main; } if(x==1600) { printf("4:00 pm"); system("pause"); goto main; } if((x>=1601)&&(x<=1699)) { c=x-1600; printf("4:%d pm",c); system("pause"); goto main; } if(x==1700) { printf("5:00 pm"); system("pause"); goto main; } if((x>=1701)&&(x<=1799)) { c=x-1700; printf("5:%d pm",c); system("pause"); goto main; } if(x==1800) { printf("6:00 pm"); system("pause"); goto main; } if((x>=1801)&&(x<=1899)) { c=x-1800; printf("6:%d pm",c); system("pause"); goto main; } if(x==1900) { printf("7:00 pm"); system("pause"); goto main; } if((x>=1901)&&(x<=1999)) { c=x-1900; printf("7:%d pm",c); system("pause"); goto main; } if(x==2000) { printf("8:00"); system("pause"); goto main; } if((x>=2001)&&(x<=2099)) { c=x-2000; printf("8:%d pm",c); system("pause"); goto main; } if(x==2100) { printf("9:00 pm"); system("pause"); goto main; } if((x>=2101)&&(x<=2199)) { c=x-2100; printf("9:%d pm",c); system("pause"); goto main; } if(x==2200) { printf("10:00 pm"); system("pause"); goto main; } if((x>=2201)&&(x<=2299)) { c=x-2200; printf("10:%d pm",c); system("pause"); goto main; } if(x==2300) { printf("11:00 pm"); system("pause"); goto main; } if((x>=2301)&&(x<=2399)) { c=x-2300; printf("11:%d pm"); system("pause"); goto main; } if(x==2400) { printf("12:00 pm"); system("pause"); goto main; } if((x>=2401)&&(x<=2499)) { c=x-2400; printf("12:%d pm",c); system("pause"); goto main; } if(x==100) { printf("1:00 am"); system("pause"); goto main; } if((x>=101)&&(x<=199)) { c=x-100; printf("1:%d am",c); system("pause"); goto main; } if(x==200) { printf("2:00 am"); system("pause"); goto main; } if((x>=201)&&(x<=299)) { c=x-200; printf("2:%d am",c); system("pause"); goto main; } if(x==300) { printf("3:00 am"); system("pause"); goto main; } if((x>=301)&&(x<=399)) { c=x-300; printf("3:%d am",c); system("pause"); goto main; } if(x==400) { printf("4:00 am"); system("pause"); goto main; } if((x>=401)&&(x<=499)) { c=x-400; printf("4:%d am",c); system("pause"); goto main; } if(x==500) { printf("5:00 am"); system("pause"); goto main; } if((x>=501)&&(x<=599)) { c=x-500; printf("5:%d am",c); system("pause"); goto main; } if(x==600) { printf("6:00 am"); system("pause"); goto main; } if((x>=601)&&(x<=699)) { c=x-600; printf("6:%d am",c); system("pause"); goto main; } if(x==700) { printf("7:00 am"); system("pause"); goto main; } if((x>=701)&&(x<=799)) { c=x-700; printf("7:%d am",c); system("pause"); goto main; } if(x==800) { printf("8:00 am"); system("pause"); goto main; } if((x>=801)&&(x<=899)) { c=x-800; printf("8:%d am",c); system("pause"); goto main; } if(x==900) { printf("9:00 am"); system("pause"); goto main; } if((x>=901)&&(x<=999)) { c=x-900; printf("9:%d am",c); system("pause"); goto main; } if(x==1000) { printf("10:00 pm"); system("pause"); goto main; } if((x>=1001)&&(x<=1099)) { c=x-1000; printf("10:%d am"); system("pause"); goto main; } if(x==1100) { printf("11:00 am"); system("pause"); goto main; } if((x>=1101)&&(x<=1199)) { c=x-1100; printf("11:%d am",c); system("pause"); goto main; } if(x==1200) { printf("12:00 pm"); system("pause"); goto main; } if((x>=1201)&&(x<=1299))
{
c=x-1200;
printf("12:%d pm",c);
system("pause");
goto main;
}
else
{
printf("error input! guys....\n\n\n\n");
system("pause");
goto main;
return 0;
}


goto main;
}
case 3:
{
system("cls");
printf("\n\n\nsuccessfully log-out!");

return 0;
}
default:
{
goto main;
}
}














}
///5
else
{
system("cls");
printf("user no register!\n\n");
goto final;
}

break;
}
///4
case 'n':
{
printf("bye bye.... see you soon!");
break;
}
///4
default:
{
goto alog;
}

}






















//f=(fopen("password.txt","w"));
// printf("PASSWORD:");
// scanf("%s",filename);
// fclose(f);



// f=(fopen(filename,"r"));
// fgets(line,500,f);
// printf("the line you enter:");
// puts(line);

break;
}
}
}
return 0;
}

No comments: