otherfunc.cpp

来自「图书管理系统,DOS界面,输入书籍保存信息」· C++ 代码 · 共 63 行

CPP
63
字号
#include "stdafx.h"
#include <conio.h>
#include <Windows.h>
#include "DataDefine.h"

///////////////////////////////////////////////////////////////////////
//
// 函数名       : gotoxy
// 功能描述     : 为VC向TC兼容而做的函数
// 参数         : int x
// 参数         : int y
// 返回值       : void 
//
///////////////////////////////////////////////////////////////////////
void gotoxy(int x,int y)
{
	COORD pos;//Max x=78,y=24
	pos.X = x;
	pos.Y = y;
	SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);//光标定位
}


///////////////////////////////////////////////////////////////////////
//
// 函数名       : GetKey
// 功能描述     : 得到用户按键
// 返回值       : int 按键值
//
///////////////////////////////////////////////////////////////////////
int GetKey()
{
	
	gotoxy(0,17);//Max x=78,y=24

	printf("请输入菜单编号:");
	int ch=getche();
	ch=toupper( ch );//转大写,好判断
	return ch;
}


///////////////////////////////////////////////////////////////////////
//
// 函数名       : FreeData
// 功能描述     : 释放data
// 参数         : BookData data[MAXSIZE]
// 返回值       : void 
//
///////////////////////////////////////////////////////////////////////
void FreeData(BookData data[MAXSIZE])
{
	for(int i=0;i<MAXSIZE;i++)
	{
		data[i].uBokno=0;//只是将书号变0表示该元素无效
		/*strcpy(data[i].szBookName,"");
		strcpy(data[i].szAuthor,"");
		strcpy(data[i].szPublic,"");
		data[i].
*/

	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?