c语言编写,自定义一个函数,要求如下功能:判断系统的登录账号密码是否正确,并输出登录结果?
是三种不同的函数验证登陆吧,check1、check2、check3三类函数分别如下:
成都创新互联主要从事成都网站制作、做网站、网页设计、企业做网站、公司建网站等业务。立足成都服务浠水,十多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:13518219792
void check1()输入输出功能全部在函数完成;
void check2(name,pass)输入在main中传入函数进行判断输出;
int check3(name,pass)输入输出均在main函数完成,函数只做判断返回结果。
#include "stdafx.h"
#include iostream
#include string
void check1()
{
char name[10], pass[10];
printf("请输入账号和密码:\n");
scanf_s("%s%s", name, 10, pass, 10);
if (!strcmp(name,"admin")!strcmp(pass,"123"))
printf("账号密码正确!\n");
else
printf("账号或密码错误!\n");
}
void check2(char *n, char *p)
{
if (!strcmp(n, "admin") !strcmp(p, "123"))
printf("账号密码正确!\n");
else
printf("账号或密码错误!\n");
}
int check3(char *n, char *p)
{
if (!strcmp(n, "admin") !strcmp(p, "123"))
return 1;
else
return 2;
}
int main()
{
char name[10], pass[10];
check1();
printf("请输入账号和密码:\n");
scanf_s("%s%s", name, 10, pass, 10);
check2(name, pass);
printf("请输入账号和密码:\n");
scanf_s("%s%s", name, 10, pass, 10);
if(check3(name,pass)==1)
printf("账号密码正确!\n");
if(check3(name,pass)==2)
printf("账号或密码错误!\n");
system("pause");
return 0;
}
C语言课程设计的界面应该使用哪些函数?
以下是graphics.h中的声明,常用的都比较好懂,实在不行就查查MSDN吧,上面有好多名字类似的函数功能都一样.
void far _Cdecl arc(int x, int y, int stangle, int endangle,
int radius);
void far _Cdecl bar(int left, int top, int right, int bottom);
void far _Cdecl bar3d(int left, int top, int right, int bottom,
int depth, int topflag);
void far _Cdecl circle(int x, int y, int radius);
void far _Cdecl cleardevice(void);
void far _Cdecl clearviewport(void);
void far _Cdecl closegraph(void);
void far _Cdecl detectgraph(int far *graphdriver,int far *graphmode);
void far _Cdecl drawpoly(int numpoints, int far *polypoints);
void far _Cdecl ellipse(int x, int y, int stangle, int endangle,
int xradius, int yradius);
void far _Cdecl fillellipse( int x, int y, int xradius, int yradius );
void far _Cdecl fillpoly(int numpoints, int far *polypoints);
void far _Cdecl floodfill(int x, int y, int border);
void far _Cdecl getarccoords(struct arccoordstype far *arccoords);
void far _Cdecl getaspectratio(int far *xasp, int far *yasp);
int far _Cdecl getbkcolor(void);
int far _Cdecl getcolor(void);
struct palettetype * far _Cdecl getdefaultpalette( void );
char * far _Cdecl getdrivername( void );
void far _Cdecl getfillpattern(char far *pattern);
void far _Cdecl getfillsettings(struct fillsettingstype far *fillinfo);
int far _Cdecl getgraphmode(void);
void far _Cdecl getimage(int left, int top, int right, int bottom,
void far *bitmap);
void far _Cdecl getlinesettings(struct linesettingstype far *lineinfo);
int far _Cdecl getmaxcolor(void);
int far _Cdecl getmaxmode(void);
int far _Cdecl getmaxx(void);
int far _Cdecl getmaxy(void);
char * far _Cdecl getmodename( int mode_number );
void far _Cdecl getmoderange(int graphdriver, int far *lomode,
int far *himode);
unsigned far _Cdecl getpixel(int x, int y);
void far _Cdecl getpalette(struct palettetype far *palette);
int far _Cdecl getpalettesize( void );
void far _Cdecl gettextsettings(struct textsettingstype far *texttypeinfo);
void far _Cdecl getviewsettings(struct viewporttype far *viewport);
int far _Cdecl getx(void);
int far _Cdecl gety(void);
void far _Cdecl graphdefaults(void);
char * far _Cdecl grapherrormsg(int errorcode);
void far _Cdecl _graphfreemem(void far *ptr, unsigned size);
void far * far _Cdecl _graphgetmem(unsigned size);
int far _Cdecl graphresult(void);
unsigned far _Cdecl imagesize(int left, int top, int right, int bottom);
void far _Cdecl initgraph(int far *graphdriver,
int far *graphmode,
char far *pathtodriver);
int far _Cdecl installuserdriver( char far *name, int huge (*detect)(void) );
int far _Cdecl installuserfont( char far *name );
void far _Cdecl line(int x1, int y1, int x2, int y2);
void far _Cdecl linerel(int dx, int dy);
void far _Cdecl lineto(int x, int y);
void far _Cdecl moverel(int dx, int dy);
void far _Cdecl moveto(int x, int y);
void far _Cdecl outtext(char far *textstring);
void far _Cdecl outtextxy(int x, int y, char far *textstring);
void far _Cdecl pieslice(int x, int y, int stangle, int endangle,
int radius);
void far _Cdecl putimage(int left, int top, void far *bitmap, int op);
void far _Cdecl putpixel(int x, int y, int color);
void far _Cdecl rectangle(int left, int top, int right, int bottom);
void far _Cdecl restorecrtmode(void);
void far _Cdecl sector( int X, int Y, int StAngle, int EndAngle,
int XRadius, int YRadius );
void far _Cdecl setactivepage(int page);
void far _Cdecl setallpalette(struct palettetype far *palette);
void far _Cdecl setaspectratio( int xasp, int yasp );
void far _Cdecl setbkcolor(int color);
void far _Cdecl setcolor(int color);
void far _Cdecl setfillpattern(char far *upattern, int color);
void far _Cdecl setfillstyle(int pattern, int color);
unsigned far _Cdecl setgraphbufsize(unsigned bufsize);
void far _Cdecl setgraphmode(int mode);
void far _Cdecl setlinestyle(int linestyle, unsigned upattern,
int thickness);
void far _Cdecl setpalette(int colornum, int color);
void far _Cdecl setrgbpalette(int colornum,
int red, int green, int blue);
void far _Cdecl settextjustify(int horiz, int vert);
void far _Cdecl settextstyle(int font, int direction, int charsize);
void far _Cdecl setusercharsize(int multx, int divx,
int multy, int divy);
void far _Cdecl setviewport(int left, int top, int right, int bottom,
int clip);
void far _Cdecl setvisualpage(int page);
void far _Cdecl setwritemode( int mode );
int far _Cdecl textheight(char far *textstring);
int far _Cdecl textwidth(char far *textstring);
/***** graphics drivers *****/
int _Cdecl registerbgidriver(void (*driver)(void));
int far _Cdecl registerfarbgidriver(void far *driver);
/* !! These "functions" are NOT user-callable !! */
/* !! They are there just so you can link in graphics drivers !! */
void _Cdecl CGA_driver(void);
void _Cdecl EGAVGA_driver(void);
void _Cdecl IBM8514_driver(void);
void _Cdecl Herc_driver(void);
void _Cdecl ATT_driver(void);
void _Cdecl PC3270_driver(void);
extern int far _Cdecl CGA_driver_far[];
extern int far _Cdecl EGAVGA_driver_far[];
extern int far _Cdecl IBM8514_driver_far[];
extern int far _Cdecl Herc_driver_far[];
extern int far _Cdecl ATT_driver_far[];
extern int far _Cdecl PC3270_driver_far[];
/***** graphics fonts *****/
int _Cdecl registerbgifont(void (*font)(void));
int far _Cdecl registerfarbgifont(void far *font);
/* !! These "functions" are NOT user-callable, !! */
/* !! they are there just so you can link in fonts !! */
void _Cdecl triplex_font(void);
void _Cdecl small_font(void);
void _Cdecl sansserif_font(void);
void _Cdecl gothic_font(void);
extern int far _Cdecl triplex_font_far[];
extern int far _Cdecl small_font_far[];
extern int far _Cdecl sansserif_font_far[];
extern int far _Cdecl gothic_font_far[];
C语言函数参数传递出错 做教务系统界面,函数如下
student_face函数需要struct student 变量作为参数,这是在第一行定义函数的语句中写的:void student_face(struct student *p)。
在倒数第二行,调用student_face()时,括号里面要写上一个student结构体名。
网站名称:c语言课设登录界面函数 c语言程序设计登录界面
本文路径:http://scgulin.cn/article/hghgig.html