求一C语言程序设计作业,工资管理系统
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了求一C语言程序设计作业,工资管理系统相关的知识,希望对你有一定的参考价值。
欢迎界面:
welcm
printf("===========================================================================/n")
printf("| /n")
printf("| /n")
printf("| >>>>> THE SALARY MANAGEMENT SYSTEM <<<< /n")
printf("| /n")
printf("| /n")
printf("| * PLEASE INPUT THE MUNBER AND PRESS "ENTTER" /n")
printf("| 1.Display All Dates /n") /*显示所有数据*/
printf("| 2.Display Certain Date /n") /*显示特殊数据*/
printf("| 3.Add Date /n") /*添加数据*/
printf("| 4.Delete Date /n") /*删除数据*/
printf("| 5.Change Dates /n") /*修改数据*/
printf("| 4.Compositor /n") /*排序*/
printf("| 5.Statistic /n") /*统计*/
printf("| 6.Exit /n") /*退出系统*/
)
结构体形式:
struct salary
int num;/*编号*/
char name[15];/*姓名*/
char pstion[20];/*职称*/
char job[20];/*职务*/
int bslry;/*基本工资*/
int bonus;/*奖金*/
int sum;/*总工资*/
;
当然上面的可以自由修改,只要功能够就行...
<a href="http://images13.51.com/30/b/6e/20/lastone621/1024_768_4638945160laston.jpg" target="_blank">http://images13.51.com/30/b/6e/20/lastone621/1024_768_4638945160laston.jpg</a>
那是我同学网上下的界面,类似做就可以
我是大一的,谭浩强那本书刚学完,可要做这种东西,是在没那个水平..还请大虾们帮帮忙,如果可以,好的答案我会追加50分,其他有帮助的答案我每人送50分,直到我分数没了(我只有387分了)...
吃饱吃好同学,我要的是C 语言的...不是html语言..又不是做网页...还有那位数字同学,那么复杂的程序,我看都看不懂(而且我怀疑老师能不能看懂),到时候还要向老师说明....我怎么办啊....
不过还是谢谢各位了...这两天要交了,所以自己也在做,不过就算没合适的,到时候分数还是会给的...
流局..........
/***模糊查询可能建链表有问题,还有填写工资单也可能有一点问题**/
#include <dos.h>
#include <bios.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define R 8
#define T 60 /****addlist有问题******************************************************************************************/
#define LEFT 0x4b00 /*左*/
#define RIGHT 0x4d00 /*右*/
#define DOWN 0x5000 /*下*/
#define UP 0x4800 /*上*/
#define SPACE 0x3920 /*空格*/
#define ESC 0x011b /* ESC键*/
#define ENTER 0x1c0d /*回车键*/
#define Backspace 0xe08 /*擦除键*/
#define ALT_B 12288 /*组合键ALT_B */
#define ALT_M 12800/*组合键ALT_M */
#define ALT_H 8960/*组合键ALT_H */
#define N 10
#define M 20
int clst,tvst; /*清洁费&&闭路电视费*/
int or=1;/*-1做了更改,1未做更改*/
char zhws[N][M],zhchs[N][M],departs[N][M]; /*存储职务名&&技术职称名&&部门名*/
char months[][5]="0","Jan","Feb","Mar","Apr","May","Jun","July","Arg","Sep","Oct","Nov","Dec";/*月份名,1月对应1*/
char sexs[][7]="male","female";
int zhwsp[N],zhchsp[N]; /*职务工资&&职称(基本)工资*/
FILE *fp;
typedef struct _paylist
int cardnum; /*工资卡号*/
char name[M];
int month; /*月份,进行选择*/
int jbsalary; /*基本工资*/
int zhwsalary; /*职务工资*/
int addition; /*补助*/
int ysalary; /*应发工资*/
int praise; /*特别奖励*/
int tax; /*税金*/
int water; /*水费*/
int elec; /*电费*/
int clean; /*清洁费*/
int tv; /*电视费*/
int salary; /*实发工资*/
struct _paylist *left,*right;
PAYLIST;
typedef struct _worker
char name[M];
int sex; /*0男1女*/
char idnum[M]; /*身份证号*/
int cardnum; /*工资卡号*/
int age;
int wkage; /*工龄*/
int depart; /*选择,部门*/
int zhw; /*选择,职务*/
int zhch; /*选择,职称*/
long zhchnum; /*职称编号*/
long homeph; /*家庭电话*/
char mobile[M]; /*手机*/
int paymons; /*已经记录n个月的工资单*/
struct _worker *front,*down;
PAYLIST *right;
WORKER;
typedef struct _depart
int name; /*选择,部门名*/
char path[M]; /*存储路径名*/
int wknum; /*该部门职工人数*/
struct _depart *left,*right;
WORKER *down;
DEPART;
typedef struct _tjw
WORKER *wp;
struct _tjw *next;
TJW;
DEPART *headd,*dep;
WORKER *zhp,*wwp;/*起指向作用,不要随便更改; 起流动作用*********/
TJW *head1; /**头指针**/
void load(void); /*从文件中导入部门,职工及工资单信息*/
void start(void); /*读取基本数据*/
void readdep(DEPART **pp,FILE *fp); /*从文件中读取部门信息*/
void writedep(DEPART *p,FILE *fp); /*逐个将部门信息写入文件*/
void shchx(WORKER *wp); /*详细输出*/
void readw(WORKER **wp,FILE *fp); /*从文件中读取职工信息*/
PAYLIST * whtailp(WORKER *wp); /*查找职工------链尾,返回链尾*/
void xianshw(void); /************显示第n个部门的职工信息********/
PAYLIST * insertp(WORKER *wp,PAYLIST *p,PAYLIST *tail); /*插入新职工,返回链尾*/
void addnew(DEPART *dep); /*增加新职工*/
PAYLIST * whtailp(WORKER *wp); /*查找职工------链尾,返回链尾*/
void changeshuju(void); /*更改基本工资等固定信息*/
PAYLIST * rulup(WORKER *wp); /*录入工资单信息*/
void addlist(WORKER *zhp); /*增加新职工*/
void Dzhg(void); /*****确定某一个具体职工****/
void xiansh2(DEPART *dep);
void insertdep(void); /****添加新的部门***/
void addzh(void); /***添加职务和职称***/
void savedep(void); /*保存部门信息*/
void savew(void); /*保存职工信息和工资信息***/
void day1(void); /***直接打印职工信息**/
void day2(void); /****将统计结果打印出来**/
void delall(DEPART *dep); /**删除整个部门**/
void delone(DEPART *dep,WORKER *p); /*删除一个职工及其工资信息*/
void changew(WORKER *p); /*修改职工基本信息*/
WORKER * search1(); /*通过身分证号查询*/
void search3(void); /*通过姓名查询*/
void mhsearch(); /*模糊查询*/
WORKER * search0(); /*通过职称编号查询*/
void jqsearch(void); /*精确查询*/
void Ashuijin(); /*统计税金总额及排出前十名**/
void changep(WORKER *p); /*修改工资单信息*/
WORKER * search2(); /*通过工资卡号查找*/
int key;/*按键变量*/
int textx,texty;/*光标坐标,x行,y列*/
struct menustruct/*菜单用的结构体*/
char name[10];/*主菜单名*/
char str[10][20];/*选项*/
int n;/*选项数*/
ml[R];/*使用了R个,可根据需要增删*/
char save[4096],savee[4096];/*保存文本区域空间*/
/*char sav1[4096];*/
char c[4096];/*清屏专用空间*/
int i,j;/*常用变量*/
void Menu();/*初始化界面*/
void Selectitem();/*定义菜单*/
void DrawSelectitem();/*显示主菜单*/
void BlackText(int x,int y,char *z);/*选中菜单*/
void RedText(int x,int y,char *z);/*正常菜单*/
void Run();/*具体操作过程*/
void DrawMl(int n);/*显示下拉菜单*/
void MoveMl(int n,int x);/*菜单选项的控制*/
void Enter(int m,int n);/*菜单选项的具体功能*/
void ClrScr();/*自定义清屏函数*/
void DingWei(void);
void DrawFrame(int left,int up,int right,int down,int textcolor,int backgroundcolor);/*画边框*/
/***主函数****/
void loadmenu(void)
Menu();/*初始化界面*/
Run();/*具体操作过程*/
/*初始化界面*/
void Menu()
int a;
system("cls"); /*调用系统的清屏命令*/
textbackground(GREEN);/*将背景设置为蓝色*/
window(1,1,25,80);
clrscr();
textx=3;/*光标初始化位置*/
texty=2;
gotoxy(1,2);
printf("%c",218);/*画左上角*/
for(i=0;i<78;i++)
printf("%c",196); /*画水平直线*/
printf("%c",191);/*画右上角*/
for(i=3;i<=23;i++)
gotoxy(1,i);
printf("%c",179); /*画垂直线*/
gotoxy(80,i);
printf("%c",179);
printf("%c",192); /*画左下角*/
for(i=0;i<78;i++)
printf("%c",196);
printf("%c",217); /*画右下角*/
gotoxy(1,1);
textcolor(7); /*设置灰色*/
for(i=0;i<80;i++)
cprintf("%c",219);/*用符号实现画主菜单的灰色背景区*/
for(a=3;a<=23;a++)
gotoxy(T,a);cprintf("%c",179); /********************************************************************/
DingWei();
Selectitem(); /*调用选项函数*/
DrawSelectitem(); /*画选项*/
gettext(2,3,78,23,c); /*保存当前文本区域*/
/*定义菜单*/
void Selectitem()
strcpy(ml[0].name,"FILE");/*下面的具体选项补空格是为了各菜单黑色背景相同*/ /**************************************************************************/
strcpy(ml[0].str[0],"Load ");/*导入某一部门职工信息*/
strcpy(ml[0].str[1],"Shemi ");/*设置密码*/
strcpy(ml[0].str[2],"Gaimi ");/*修改密码*/
strcpy(ml[0].str[3],"Print ");/*打印*/
strcpy(ml[0].str[4],"Save ");/*保存*/
strcpy(ml[0].str[5],"Exit ");/*退出系统*/
ml[0].n=6; /*保存菜单的项数*/
strcpy(ml[1].name,"INSERT");
strcpy(ml[1].str[0],"Newers ");/*插入新职工*/
strcpy(ml[1].str[1],"Paylist ");/*填写工资单*/
strcpy(ml[1].str[2],"Depart ");/*新增部门*/
strcpy(ml[1].str[3],"Zhchs "); /*新增职称*/
strcpy(ml[1].str[4],"Zhws "); /*新增职务*/
ml[1].n=5;
strcpy(ml[2].name,"EDIT");/*编辑修改*/
strcpy(ml[2].str[0],"Imfor "); /*职工信息*/
strcpy(ml[2].str[1],"Paylist "); /*工资单*/
strcpy(ml[2].str[2],"Tongshu ");/*修改基本工资等固定数据*/
ml[2].n=3;
strcpy(ml[3].name,"SEARCH"); /*查询*/
strcpy(ml[3].str[0],"Jingque "); /*精确查询*/
strcpy(ml[3].str[1],"Mohu "); /*模糊查询*/
ml[3].n=2;
strcpy(ml[4].name,"TONGJI"); /*统计*/
strcpy(ml[4].str[0],"Paixu "); /*排序*/
strcpy(ml[4].str[1],"Agongzi "); /*各类工资总额*/
strcpy(ml[4].str[2],"Ashuijin "); /*税金总额(月/年) */
strcpy(ml[4].str[3],"Gzhjigz "); /*各工种总数及平均工资*/
ml[4].n=4;
strcpy(ml[5].name,"DEL");
strcpy(ml[5].str[0],"One ");
strcpy(ml[5].str[1],"All ");
ml[5].n=2;
strcpy(ml[6].name,"HELP");
strcpy(ml[6].str[0],"About ");
ml[6].n=1;
/*显示主单名*/
void DrawSelectitem()
for(i=0;i<R;i++)
RedText(i,1,ml[i].name); /*显示主菜单名,且首字母为红色*/
/*正常显示菜单*/
void RedText(int x,int y,char *z)
textbackground(7); /*设置背景颜色为浅灰色*/
gotoxy(3+x*10,y);
for(j=0;z[j];j++)
if(j==0)
textcolor(RED);/*第一个字母显示红色*/
else
textcolor(BLACK); /*设置黑色*/
cprintf("%c",z[j]); /*输出菜单名*/
/*显示选中菜单*/
void BlackText(int x,int y,char *z)
textbackground(0); /*设置背景颜色为黑色*/
textcolor(15); /*设置文本颜色为白色*/
gotoxy(3+10*x,y);/*定位坐标*/
cputs(z); /*输出菜单名字符串*/
/*按键操作过程*/
void Run()
gettext(1,1,80,25,savee);
while(1)
gotoxy(texty,textx);
key=bioskey(0);/*接收按键*/
switch(key)
case ALT_B:
case ESC: DrawMl(0);break; /*显示下拉菜单1*/
case ALT_M: DrawMl(1);break;/*显示下拉菜单2*/
case ALT_H: DrawMl(2);/*显示下拉菜单3*/
case UP: /*上光标键的操作控制*/
if(textx==3)
textx=23;
textx--;
gotoxy(texty,textx);
break;
case DOWN: /*下光标键的操作控制*/
if(textx==23)
textx=3;
textx++;
gotoxy(texty,textx);
break;
case LEFT: /*左光标键的操作控制*/
if(texty==2)
texty=T-1;
texty--;
gotoxy(texty,textx);
break;
case Backspace: /*擦除键的设置*/
if(texty==2&&textx==3)
continue;
else
if(texty!=2)
texty--; /*擦除键的细节问题,先擦去东西,然后光标还要往后退一格*/
else
if(texty==2)
texty=78;
textx--;
gotoxy(texty,textx);
printf(" ");
gotoxy(texty,textx);
break;/*end case 0xe08*/
case RIGHT: /*右光标键的操作控制*/
if(texty==T-1)
texty=2;
texty++;
gotoxy(texty,textx);
break;
case SPACE: /*空格键的操作*/
if(texty==79)
continue;
else
gotoxy(texty,textx); /*空格的细节操作*/
printf(" ");
texty++;
gotoxy(texty,textx);
break;
case ENTER: /*回车的控制操作*/
if(textx==23)
continue;
textx++;
texty=2;
gotoxy(texty,textx);
break;
default : /*非控制键的结果*/
if(texty==79&&textx==23)/*到达最后就不再输出*/
continue;
else
if(texty==79&&textx!=23) /*到行的最后*/
textx++;
texty=2;
gotoxy(texty,textx);/*输出结果*/
printf("%c",key);
if(texty==79) /*如果texty==79就不执行*/
continue;
else /*如果没到行尾就继续执行,使光标向前移动一位*/
texty++;
/*大循环的大括号*/
/*画边框函数*/
void DrawFrame(int l,int u,int r,int d,int tcolor,int bcolor)
textbackground(bcolor); /*背景颜色*/
textcolor(bcolor); /*文本颜色*/
for(i=l;i<=r;i++) /*输出背景区域*/
for(j=u;j<=d;j++)
gotoxy(i,j);
printf("%c",219); /*输出背景字符*/
textcolor(tcolor);/*边框颜色*/
for(i=u+1;i<d;i++) /*在背景区域内输出边框线*/
gotoxy(l,i);
cprintf("%c",179); /*垂直线*/
gotoxy(r,i);
cprintf("%c",179);
for(i=l+1;i<r;i++)
gotoxy(i,u);
cprintf("%c",196); /*水平线*/
gotoxy(i,d);
cprintf("%c",196);
gotoxy(l,u);
cprintf("%c",218);/*左上角*/
gotoxy(r,u);
cprintf("%c",191);/*右上角*/
gotoxy(l,d);
cprintf("%c",192);/*左下角*/
gotoxy(r,d);
cprintf("%c",217); /*右下角*/
/* gettext(l+1,u+1,r-1,d-1,save1);*//*保存边框内区域*/
/*显示具体下拉选择项目*/
void DrawMl(int n)
gettext(1,1,80,25,save);/*保存被掩盖的地方*/
BlackText(n,1,ml[n].name);/*反选显示主菜单*/
DrawFrame(3+10*n-1,2,3+10*n+9,3+ml[n].n,0,7);/*下拉菜单的边框*/
for(i=3;i<3+ml[n].n;i++)/*输出所选菜单各选项*/
if(i==3)
BlackText(n,i,ml[n].str[i-3]);/*默认选中第一项*/
else
RedText(n,i,ml[n].str[i-3]);/*其余各项首字符红色显示*/
gotoxy(79,1);
MoveMl(n,3);/*菜单选项的控制*/
/*菜单选项的控制,n决定水平项,x决定下拉的选项*/
void MoveMl(int n,int x)
int flag=1;
while(flag)
gotoxy(79,1);
key=bioskey(0);/*接收按键*/
gotoxy(79,1);
switch(key)
case ESC:/*退出循环*/
puttext(1,1,80,25,save);/*恢复打开菜单前的样子*/
flag=0;
break;
case LEFT:/*移到左边的选项*/
puttext(1,1,80,25,save);/*恢复打开菜单前的样子*/
if(n==0)/*往左移动越界的话移到最后一个选项*/ /*II***************************************************************注意改******************************/
DrawMl(6);
else
DrawMl(n-1);
flag=0;
break;
case RIGHT:/*移动右边的选项*/
puttext(1,1,80,25,save);/*恢复打开菜单前的样子*/
if(n==6)/*往右移动越界的话移到第一个选项*/ /*********************注意改**********************/
DrawMl(0);
else
DrawMl(n+1);
flag=0;
break;
case UP:/*具体选项往上移动*/
RedText(n,x,ml[n].str[x-3]);/*输出红色字体*/
if(x==3)/*移到最上面再按上键,就移到最下面*/
x=3+ml[n].n-1;
else
x--;/*移动到新的要显示的内容*/
BlackText(n,x,ml[n].str[x-3]);/*输出黑色字体*/
flag=1;
break;
case DOWN:/*具体选项往下移动*/
RedText(n,x,ml[n].str[x-3]);
if(x==(3+ml[n].n-1))/*移动到最底下再按下键就移到最上面*/
x=3;
else
x++;/*移动到新的要显示的内容*/
BlackText(n,x,ml[n].str[x-3]);
flag=1;
break;
case ENTER:
puttext(1,1,80,25,save);/*恢复打开菜单前的样子*/
Enter(n,x-3);/*菜单选项的具体功能*/
flag=0;
break;
gotoxy(79,1);
/*菜单选项的具体功能*/
void Enter(int m,int n) /*m主菜单;n子菜单*/
switch(m)
case 0:switch(n)
case 0:xianshw();break;
case 1:break;
case 2:break;
case 3:day1();break;
case 4:savedep();savew();printf("Save successfully!!");
puttext(1,1,80,25,save);break;
case 5:exit(0);break;
break;/*退出系统*/
case 1: switch(n)
case 0:addnew(dep);puttext(1,1,80,25,save); /***********************************后面还要在接一个关闭窗口函数*****/
break;
case 1: addlist(zhp); puttext(1,1,80,25,save); break; /*填写工资单*/
case 2:insertdep(); break;/****添加新的部门***/
case 3:
case 4:addzh(); puttext(1,1,80,25,save); /*添加新的职务和职称***/
break;
case 2:switch(n)
case 0:changew(zhp);break;
case 1:changep(zhp);puttext(1,1,80,25,save);break;
case 2:clrscr();changeshuju();puttext(1,1,80,25,save); break;
break;
case 3:switch(n)
case 0:jqsearch();break;
case 1:mhsearch();break;
break;
case 4:switch(n)
case 0:
case 1:
case 2:
case 3:Ashuijin();puttext(1,1,80,25,save);break;
break;
case 5:switch(n)
case 0:delone(dep,zhp); break;
case 1:delall(dep);break;
break;
case 6:switch(n)
case 0:break;
break;
/*结束外switch*/
void DingWei(void)
int a=3;
gotoxy(T+1,a);cprintf("name:");
gotoxy(T+1,a+1);cprintf("sex:");
gotoxy(T+1,a+2);cprintf("id:");
gotoxy(T+1,a+3);cprintf("cd:");
gotoxy(T+1,a+4);cprintf("ag:");
gotoxy(T+1,a+5);cprintf("wg:");
gotoxy(T+1,a+6);cprintf("dp:");
gotoxy(T+1,a+7);cprintf("zw:");
gotoxy(T+1,a+8);cprintf("zc:");
gotoxy(T+1,a+9);cprintf("zcn:");
gotoxy(T+1,a+10);cprintf("hp:");
gotoxy(T+1,a+11);cprintf("mb:");
gotoxy(T+1,a+13);cprintf("paylist of:");
gotoxy(T+1,a+14);cprintf("jb:");gotoxy(T+10,a+14);cprintf("pr:");
gotoxy(T+1,a+15);cprintf("wp:");gotoxy(T+10,a+15);cprintf("tax:");
gotoxy(T+1,a+16);cprintf("ad:");gotoxy(T+10,a+16);cprintf("wt:");
gotoxy(T+1,a+17);cprintf("ys:");gotoxy(T+10,a+17);cprintf("el:");
gotoxy(T+1,a+18);cprintf("cn:");gotoxy(T+10,a+18);cprintf("tv:");
gotoxy(T+1,a+19);cprintf("sy:");
void start(void) /*读取基本数据*/
FILE *fp; int i,j;
DEPART *p,*tail;
if((fp=fopen("d:\\sal\\zong.dat","r"))==NULL)
printf("Cannot open the file d:\\sal\\zong.dat");
exit(-1);
fscanf(fp,"%d%d",&clst,&tvst);
fscanf(fp,"%d",&j);
for(i=0;i<N&&i<j;i++)
fscanf(fp,"%s",departs[i]);
if(i<N)for(i=j;i<N;i++)departs[i][0]='\0';
fscanf(fp,"%d",&j);
for(i=0;i<N&&i<j;i++)
fscanf(fp,"%s",zhchs[i]);
if(i<N)for(i=j;i<N;i++)zhchs[i][0]='\0';
fscanf(fp,"%d",&j);
for(i=0;i<N&&i<j;i++)
fscanf(fp,"%s",zhws[i]);
if(i<N)for(i=j;i<N;i++)zhws[i][0]='\0';
for(i=0;i<N;i++)
fscanf(fp,"%d",&zhchsp[i]);
for(i=0;i<N;i++)
fscanf(fp,"%d",&zhwsp[i]);
if((p=malloc(sizeof(DEPART)))==NULL)
printf("Nei Cun Bu Zu!");exit(-1);
readdep(&p,fp); /*从文件中读取部门信息*/
headd=p;
headd->left=NULL;
headd->right=NULL;
headd->down=NULL;
if((p=malloc(sizeof(DEPART)))==NULL)
printf("Nei Cun Bu Zu!");exit(-1);
readdep(&p,fp);
tail=p;
tail->right=NULL;
tail->left=headd;
tail->down=NULL;
headd->right=tail;
while(!feof(fp))
if((p=malloc(sizeof(DEPART)))==NULL)
printf("Nei Cun Bu Zu!");exit(-1);
readdep(&p,fp);
tail->right=p;
p->left=tail;
tail=p;
tail->right=NULL;
tail->down=NULL;
fclose(fp);
return;
void savedep(void) /*保存部门信息*/
FILE *fp;int i;
DEPART *p;
if((fp=fopen("d:\\sal\\zong.dat","w+"))==NULL)
printf("Cannot open the file d:\\sal\\zong.dat");
exit(-1);
fprintf(fp,"%10d%10d",clst,tvst);
for(i=0;i<N&&departs[i][0]!=NULL;i++);
fprintf(fp," %d ",i);
for(i=0;i<N;i++)
fprintf(fp," %s ",departs[i]); putchar('\n');
for(i=0;i<N&&zhchs[i][0]!=NULL;i++);
fprintf(fp," %d ",i);
for(i=0;i<N;i++)
fprintf(fp," %s ",zhchs[i]); putchar('\n');
for(i=0;i<N&&zhws[i][0]!=NULL;i++);
fprintf(fp," %d ",i);
for(i=0;i<N;i++)
fprintf(fp," %s ",zhws[i]); putchar('\n');
for(i=0;i<N;i++)
fprintf(fp," %d ",zhchsp[i]); putchar('\n');
for(i=0;i<N;i++)
fprintf(fp," %d ",zhwsp[i]); putchar('\n');
for(p=headd;p->right!=NULL;p=p->right)
writedep(p,fp); putchar('\n');
fclose(fp);
return;
void changeshuju(void) /*更改基本工资等固定信息*/
int i;
char ch;
textbackground(GREEN);textcolor(15);clrscr();
printf("\nThe clean cost:%7d",clst);
printf("\nThe tv cost:%7d",tvst);
printf("\nIs there anything to be changed?(y/n):");
scanf("%1s",&ch);
if(ch=='y'||ch=='Y')
printf("\nThe clean cost:");
scanf("%d",&clst);
printf("\nthe tv cost:");
scanf("%d",&tvst);
pri 参考技术A <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" import="java.sql.*;" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
String name = request.getParameter("name");
String password = request.getParameter("password");
//-------if input is empty or not-------------
if(name.equals(""))
out.println("<html><body onload=\"alert('you must input name');history.back()\">");
//out.println("<input type='button' value='return' onclick='history.back()'>");
out.println("</body></html>");
return;
if(password.equals(""))
out.println("<html><body>");
out.println("<html><body onload=\"alert('you must input password');history.back()\">");
//out.println("<input type='button' value='return' onclick='history.back()'>");
out.println("</body></html>");
return;
// ----------begin getting connection
Connection con = null;
String URL = "jdbc:oracle:thin:@localhost:1521:ORA92";
String USER = "myuser";
String PASSWORD= "myuser";
ResultSet rset = null;
//create connection
try
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection(URL,USER,PASSWORD);
catch (SQLException e)
e.printStackTrace();
catch (ClassNotFoundException e)
e.printStackTrace();
//----------Check user password-------
Statement stmt = null;
try
stmt = con.createStatement ();
System.out.println("Name:"+name);
PreparedStatement pstmt = con.prepareStatement("select password from testtable where name = ?");
pstmt.setString(1,name);
rset = pstmt.executeQuery();
//System.out.println("1");
if(rset.next())
//System.out.println("2");
String pw = rset.getString("password");
System.out.println("password input:"+password+" pw:"+pw);
if(pw.equals(password))
%>
<table width="100%" border="0">
<tr>
<td width="80" algin="left">Name :<%=name%></td>
<td></td>
<td width="80" algin="right">
<input type="button" name="addBtn" value="ADD" style="float:right" onclick ="window.location.href='/testweb/topic.html'">
</td>
</tr>
</table>
<br> <hr> <br>
Topic:<br>
<%
else
out.println("<html><body onload=\"alert('wrong password');history.back()\">");
//out.println("<input type='button' value='return' onclick='history.back()'>");
return;
else
%>
<html>
<body onload="alert('no such user!');history.back()">
</body>
</html>
<% return;
catch (SQLException e)
e.printStackTrace();
finally
rset.close();
stmt.close();
//--------------query for topic name
stmt = null;
rset = null;
try
stmt = con.createStatement ();
String sql = "select name from topic";
rset = stmt.executeQuery (sql);
while(rset.next())
String tName = rset.getString("name");
out.println ("<a target=\"_blank\" href=\"/testweb/brouse.jsp?tname="+tName+"\" >"+tName+"</a><br>");
catch (SQLException e)
e.printStackTrace();
finally
rset.close();
stmt.close();
//close connection
if(con != null)
con.close();
%>
</body>
</html>
这是我自己写的 可能有漏洞 做参考吧 参考技术B 不知道统计的功能是具体指的什么
特殊数据是什么
求一c语言程序,输入两个数,判断他们是不是相等
已知数的长度小于50,已知是十进制,可能一个用科学计数法表示,一个普通表示。已知long long int存不下,已知double会损失精度,不会莫扰
#include <stdio.h>#include <string.h>
#include <stdlib.h>
int main(void)
char a[60],b[60];
printf("输入第一个数:");
scanf("%s",a);
printf("输入第二个数:");
scanf("%s",b);
if(strcmp(a,b)) printf("两个数不相等\n");
else printf("两个数相等\n");
system("pause");
return 0;
参考技术A 用string存行不?
以上是关于求一C语言程序设计作业,工资管理系统的主要内容,如果未能解决你的问题,请参考以下文章