导航:首页 > 编程语言 > 程序开发范例宝典源码

程序开发范例宝典源码

发布时间:2023-11-28 22:13:24

『壹』 ASP程序开发范例宝典的目录

第1章表单、窗口与导航条设计
1.1下拉列表
实例001把数据库中的记录显示到下拉列表中
实例002将数组中的数据添加到下拉列表中
实例003级联菜单
实例004修改数据时下拉列表的默认值为数据库中原数据信息
实例005可以输入文字的下拉列表
实例006应用下拉列表选择所要联机的网站
实例007根据下拉列表的值显示不同控件
1.2动态添加表单元素
实例008根据数据表结构自动生成数据录入页面
实例009投票信息一次性设置
1.3文本框组件的应用
实例010自动计算金额
实例011设置文本框的只读属性
实例012让您的密码域更安全
实例013限制多行文本域输入的字符个数
1.4单选按钮组
实例014不提交表单获取单选按钮的值
实例015选中单选按钮后显示其他表单元素
1.5表单的应用
实例016防止表单在网站外部提交
实例017带记忆功能的表单
1.6弹出窗口控制
实例018打开新窗口显示广告信息
实例019自动关闭的广告窗口
实例020弹出窗口居中显示
实例021打开新窗口显示详细信息
实例022弹出窗口的Cookie控制
实例023为弹出的窗口加入关闭按钮
实例024关闭弹出窗口时刷新父窗口
实例025应用window.close()关闭窗口
1.7弹出网页对话框
实例026弹出网页(模式)对话框
实例027弹出全屏显示的网页(模式)对话框
实例028网页拾色器
1.8无边框窗口
实例029全屏显示无边框有滚动条窗口
实例030应用JavaScript实现指定尺寸的无边框窗口
实例031应用CSS+DIV实现无边框窗口
1.9水平导航条应用
实例032带图标的文字导航条
实例033flash导航条
实例034按钮导航条
实例035导航条的动画效果
实例036不用图片实现质感导航条
1.10下拉菜单式导航条
实例037二级导航菜单
实例038半透明背景的下拉菜单
实例039弹出式下拉菜单
实例040展开式导航条
1.11侧导航条设计
实例041导航按钮
实例042收缩式导航菜单
实例043树状导航菜单
第2章代码封装技术
2.1数据库操作函数
实例044通用数据库连接函数
实例045测试数据库连接
2.2窗口与对话框
实例046弹出提示对话框并重定向网页
实例047打开指定大小的新窗口并居中显示
2.3字符串处理
实例048自动获得汉字的拼音简码
实例049转换输入文本中的回车和空格
实例050小写金额转换为大写金额
实例051判断字符串是否以指定字符开头
实例052把一个长数字分位显示
实例053检查字符是否是英文字母
实例054计算字符串的实际长度
实例055将数字字符串格式化为指定长度
实例056将RGB格式的颜色值转换为十六进制格式
实例057将IP地址转换为对应的数值
实例058字符串转换成数组
实例059截取字符串
实例060ASP生成条形码
实例061过滤输入字符串中的危险符号
2.4数据验证
实例062验证输入的日期格式是否正确
实例063检查表单元素是否为空
实例064服务器端验证E-mail是否正确
实例065客户端验证E-mail是否正确
实例066通过正则表达式验证电话号码
实例067应用正则表达式验证车牌号码
实例068验证输入的字符串是否为汉字
实例069验证身份证号码
实例070客户端验证用户名和密码
实例071验证网址是否合法
实例072验证数量和金额
实例073限制输入字符串的长度
2.5身份验证
实例074用户登录模块
实例075带状态识别的用户登录模块
2.6日期与时间
实例076显示长日期格式的系统日期
实例077实时显示系统时间
实例078倒计时
实例079特殊日期提示
2.7随机函数
实例080随机产生指定位数的验证码
实例081生成随机字符串
第3章数据库技术
3.1连接Access数据库
实例082通过DSN连接数据库
实例083通过ADO连接数据库
实例084通过OLEDB连接数据库
实例085连接加密的Access数据库
3.2连接SQLServer数据库
实例086通过非DSN连接数据库
实例087通过OLEDB连接数据库
实例088通过DSN连接数据库
3.3数据插入
实例089单条数据录入
实例090批量数据录入
实例091插入系统日志信息
3.4立即获取插入记录的自动编号
实例092获取SQLServer数据库中插入记录的自动编号
实例093获取Access数据库中插入记录的自动编号
3.5数据更新
实例094更新指定记录
实例095批量更新
实例096商品价格调整
3.6数据删除
实例097删除指定记录
实例098批量删除数据
实例099删除数据前给予提示
实例100记录从数据库里删除的记录数
3.7分页显示数据信息
实例101分页显示
实例102查询结果分页显示
实例103转到指定页的分页
实例104具有页码跳转功能的分页
实例105分栏显示
实例106分类、分栏显示
实例107统计记录集中数据的数量
实例108对超长文本数据进行分页显示
3.8密码管理
实例109修改密码
实例110找回密码
3.9锁定记录
实例111在线售票
实例112自动生成编号
3.10在ASP中应用事务
实例113事务在插入多表数据中的应用
实例114事务在添加留言信息中的应用
实例115事务在删除数据中的应用
3.11使用代码创建数据库、数据表和字段
实例116动态创建Access数据库
实例117动态创建SQL数据库
实例118动态创建SQL数据表和字段
3.12枚举数据库中的数据表
实例119列举SQLServer数据库中的数据表
实例120列举Access数据库中的数据表
3.13查看及修改数据表结构
实例121查看数据表结构
实例122在线维护投票数据库
3.14在线删除表或索引
实例123在线删除指定的一个数据表
实例124在线删除多个指定的数据表
实例125在线删除索引
3.15清除部分或全部数据表中的数据
实例126清空指定数据表中的所有数据
实例127清空指定数据表中的全部记录并插入指定ID的新记录
实例128批量清空数据表
3.16生成和恢复SQL数据库脚本
实例129生成SQL数据库脚本
实例130恢复SQL数据库脚本
3.17SQLServer数据库备份与恢复
实例131SQLServer数据备份
实例132SQLServer数据恢复
3.18Access数据库备份与恢复
实例133Access数据备份
实例134Access数据恢复
实例135Access数据压缩
3.19其他
实例136不刷新页面筛选数据库中的数据
实例137动态附加数据库
实例138连接Oracle数据库
第4章SQL查询相关技术
4.1查询常量
实例139查询数值型数据
实例140查询字符串
实例141查询日期型数据
实例142查询逻辑型数据
实例143查询非空数据
4.2查询控件
实例144查询指定控件内字符串
实例145查询指定控件内数据
实例146查询日期控件内数据
实例147控件作为字段、操作符和内容进行查询
4.3查询变量
实例148利用变量查询字符串数据
实例149利用变量查询数值型数据
4.4查询名列前茅或垫底者
实例150查询前10名数据
实例151查询后10名数据
实例152取出数据统计结果前10名数据
4.5周期、日期查询
实例153查询指定ACCESS数据库中的日期型数据
实例154查询指定SQLServer数据库中的日期型数据
实例155查询指定时间段的数据
实例156按月查询统计数据
4.6大小比较、逻辑查询、重复
实例157查询大于指定条件的数据
实例158查询时不显示重复记录
实例159NOT与谓词进行组合条件的查询
实例160列出数据中的重复记录和记录条数
4.7排序、分组统计
实例161对数据进行降序查询
实例162对数据进行多条件排序
实例163对统计结果进行排序
实例164单列数据分组统计
实例165多列数据分组统计
实例166多表分组统计
实例167使用COMPUTER和COMPUTERBY
4.8聚集函数
实例168利用聚集函数SUM对学生成绩进行汇总
实例169利用聚集函数AVG求某班学生的平均成绩
实例170利用聚集函数MIN求销售额、利润最少的商品
实例171利用聚集函数MAX求月销售额完成最多的销售记录
实例172利用聚集函数COUNT求日销售额大于某值的记录数
实例173利用聚集函数First或Last求数据表中第一条或最后一条记录
4.9多表查询
实例174利用from子句进行多表查询
实例175使用表的别名
实例176合并多个结果集
4.10嵌套查询
实例177简单的嵌套查询
实例178复杂的嵌套查询
实例179嵌套查询在查询统计中的应用
4.11子查询
实例180用子查询作派生的表
实例181用子查询作表达式
实例182用子查询关联数据
4.12联合语句
实例183多表联合查询
实例184对联合查询后的结果进行排序
实例185条件联合语句
4.13内连接查询
实例186简单内连接查询
实例187复杂内连接查询
实例188选择一个表中与另一个表中的行相关的所有行
4.14外连接查询
实例189使用外连接进行多表联合查询
实例190leftouterjoin查询
实例191rightouterjoin查询
4.15利用IN进行查询
实例192利用in或notin语句限定范围
实例193用IN查询表中的记录信息
实例194由IN引入的关联子查询
4.16交叉表查询
实例195利用transform分析数据
实例196利用transform动态分析数据
4.17函数查询
实例197在查询语句中使用格式化函数格式条件
实例198在查询中使用字符串函数
实例199在查询中使用日期函数
4.18HAVING语句应用
实例200利用having语句过滤分组数据
4.19更新数据
实例201更新单条数据
实例202批量修改数据
实例203将指定字段数据为空的记录添上数据
4.20删除数据
实例204删除单条数据
实例205删除指定字段数据为空的记录
第5章视图、存储过程和触发器的应用
5.1视图的应用
实例206创建视图
实例207在ASP中应用视图
实例208获取数据库中的全部用户视图
实例209修改视图
实例210删除视图
5.2在ASP中使用存储过程
实例211创建存储过程
实例212应用存储过程实现登录身份验证
实例213应用存储过程添加数据
实例214应用存储过程实现数据分页
实例215获取数据库中全部的存储过程
实例216修改存储过程
实例217删除存储过程
5.3在ASP中使用SQLServer触发器
实例218创建触发器
实例219应用触发器自动插入回复记录
实例220获取数据库中的触发器
实例221应用触发器添加数据
实例222应用触发器修改数据
实例223应用触发器删除数据
第6章文件管理
6.1文件上传
实例224单一文件上传到数据库
实例225将文件与表单数据一同上传到数据库
实例226使用组件上传文件到数据库
实例227上传文件到服务器
实例228使用组件上传文件到服务器
实例229限制上传文件的大小
6.2文件下载
实例230应用Stream对象实现文件下载
实例231获取下载文件所需时间
6.3对文件的基本操作
实例232对文件的创建、删除、移动、复制的操作
实例233对文件名称的修改
6.4文件操控
实例234从文本文件中读取注册服务条款
实例235应用文本文件保存访客人数的计数器
实例236判断文件是否被改动
实例237远程批量重命名文件
实例238通过文本文件向数据库文件中传递数据
实例239用ASP生成HTML
6.5对文件夹的操作
实例240对文件夹创建、删除、移动、复制的操作
实例241对文件夹名称的修改
6.6遍历文件
实例242遍历指定目录下的所有文件
实例243遍历指定驱动器
实例244获取驱动器信息
6.7其他
实例245获取文件信息
实例246读取注册表信息
实例247读取驱动器信息
第7章图形与多媒体
7.1头像选择
实例248通过下拉列表选择头像
实例249从网页对话框中选择头像
7.2图片上传
实例250将图片文件保存到数据表
实例251限制上传图片的格式
7.3显示数据表中的二进制图片
实例252显示数据表中的单个图片文件
实例253连续显示数据表中的图片
实例254按实际大小显示图片
7.4控制、显示图片特效
实例255通过滑动鼠标放大或缩小图片
实例256显示随机图像
实例257如何实现图片的动态翻动的效果
实例258播放图片
实例259浮动广告
实例260投票结果柱形图显示
实例261获取页面中图像的实际尺寸
7.5插入Flash动画
实例262插入Flash动画
实例263插入背景透明的Flash动画
7.6在线播放与下载
实例264在线点播
实例265MP3文件下载
实例266自制视频播放器
实例267带记忆的在线影片欣赏
第8章在线统计
8.1网站计数器
实例268通过Application对象实现网站计数器
实例269网站图形计数器
实例270记录用户IP地址的计数器
实例271只对新用户计数的计数器
8.2统计用户停留时间
实例272统计用户在某一页停留的时间
实例273统计用户在站点停留的时间
8.3在线统计
实例274判断用户是否在线
实例275实时统计在线人数
8.4统计网站访问量
实例276统计日访问量
实例277利用柱形图统计分析网站访问量
第9章ActiveX组件
9.1广告轮显组件
实例278制作旗帜广告条
实例279随机广告
9.2计数器组件
实例280图形计数器
实例281幸运有奖
实例282自动生成Web导航链接(contentlinking组件实现)
9.3BrowserCapabilities组件
实例283显示浏览器信息
实例284根据获取的浏览器名称及版本显示不同的页面
9.4注册DLL或OCX组件
实例285本机注册
实例286远程注册DLL组件
9.5图表分析组件
实例287获取情报曲线分析图
实例288年销售额及利润柱形图分析
实例289年销售额及利润折线图分析
9.6VB订制组件
实例290文件上传组件
实例291Ping组件
9.7调用Delphi编写的OCX组件
实例292显示系统时钟组件
实例293自制媒体播放器组件
9.8日历组件
实例294调用MicrosoftDateandTimePicker组件
实例295调用Delphi编写的日历组件
第10章E-mail短信
10.1发送邮件
实例296利用E-mail发送邮件
实例297邮件群发
实例298带附件的邮件发送程序
实例299利用AspEmail组件发送邮件
实例300利用MicrosoftOutLook发送邮件
10.2构建邮件服务器
实例301利用CDONTS组件发送邮件
实例302接收邮件
第11章报表与打印
11.1Web打印
实例303利用JavaScript调用IE自身的打印功能实现打印
实例304利用WebBrowse打印
11.2利用Word打印报表
实例305将页面中的客户列表导出到Word并打印
实例306利用Word自动打印指定格式的会议记录
11.3利用Excel打印报表
实例307利用Excel打印学生信息报表
实例308将web页面中的数据导出到Excel并自动打印
11.4打印库存报表
实例309打印库存明细表
实例310打印库存盘点报表
实例311打印库存汇总报表
实例312打印指定条件的库存报表
11.5套打邮寄产品单
实例313打印汇款单
实例314打印快递单
实例315打印信封
11.6利用CSS样式打印
实例316利用CSS样式打印页面中的指定内容
实例317利用CSS样式实现分页打印
第12章应用与控制
12.1调用Word
实例318将表格数据保存到Word
实例319将查询结果保存到Word
12.2在ASP中访问Excel
实例320通过ADO访问Excel
实例321直接访问Excel
12.3导出数据到Excel
实例322将table数据导出到Excel
实例323将查询结果导出到Excel
12.4导出SQLServer数据
实例324将数据导出到Access数据库
实例325将数据导出到Excel
12.5ASP中压缩与解压缩RAR文件
实例326ASP中压缩RAR文件
实例327ASP中解压缩RAR文件
12.6其他
实例328在ASP中调用PowerPoint
实例329在ASP中编写并调用类
第13章Ajax技术
13.1ASP操作XML数据
实例330向XML文件中动态添加数据
实例331读取指定XML文件中的数据
实例332分页显示XML文件中的数据
13.2无刷新技术应用
实例333不刷新页面查询数据库中的数据
实例334实时验证用户注册信息
实例335XML留言板
实例336无刷新广告轮显
第14章安全技术
14.1用户登录
实例337用户安全登录
实例338带验证码的用户登录模块
实例339分级用户登录
实例340如果未登录浏览某页,强制跳到登录页面
14.2权限
实例341测试管理员级别
实例342权限不够弹出的对话框
14.3获取客户端信息
实例343确定对方的IP地址
实例344获取客户端TCP/IP端口的方法
14.4禁止用户复制网页内容及保护源码
实例345禁止用户复制网页内容(方法一)
实例346禁止用户复制网页内容(方法二)
实例347禁止网页被另存为
实例348防止网页被盗链
实例349使用ScriptEncoder加密工具加密
实例350将ASP文件转换成HTML文件
14.5数据加密
实例351对登录密码进行加密
实例352应用变换法对系统日志信息加密
实例353应用数字加密算法对用户密码加密
14.6Access数据库安全
实例354防止Access数据库被下载
实例355设置数据库密码
14.7防止SQL注入
实例356替换输入字符串中的危险字符
实例357禁止用户输入字符串中的危险字符
实例358防止表单被重复提交
14.8禁止用户刷新屏幕
实例359屏蔽IE主菜单
实例360屏蔽键盘相关事件
实例361屏蔽鼠标右键
第15章建站与程序调试
15.1配置IIS服务器
实例362在Windows2000Server中配置IIS5.0
实例363在WindowsXP+IIS中配置IIS
实例364在Windows2003Server中配置IIS
15.2配置数据库服务器需要注意的事项
实例365SQLServer数据库注意事项
实例366Access数据库不能更新
15.3程序调试与错误处理
实例367应用MicrosoftScriptDebugger调试程序
实例368解决SQLServer中用户登录失败
实例369解决SQLServer语句出现的错误
实例370解决“没有权限”错误
实例371截获系统错误并给出友好提示
实例372常用错误代码一览
15.4服务器安全设置
实例373设置和管理账户
实例374windows2003安装的安全设置
实例375Windows2003远程管理WEB站点
实例376Windows安全设置
实例377配置IIS服务
实例378管理服务器IIS用户
15.5其他
实例379FTP服务器
实例380在IIS中建立WAP服务器
实例381Asp配置虚拟目录
第16章网站设计与网页配色
16.1企业网站
实例382电脑产品
实例383软件产品
实例384汽车销售
实例385物流
实例386宾馆酒店
实例387工业产品
16.2大型门户类网站
实例388综合性门户
实例389搜索引擎
实例390垂直门户
16.3机构类网站
实例391政务
实例392市委党校
实例393银行
16.4教育类网站
实例394院校
实例395招生
实例396科研
实例397培训学校
实例398考试
16.5电子商务类
实例399图书
实例400购物
16.6生活资讯类
实例401电信
实例402家居
实例403中介
实例404房地产
16.7其他
实例405个人主页
实例406游戏
实例407电影
实例408美食
第17章行业应用(综合应用)
17.1用户注册
实例409一般用户注册
实例410带检测用户名的用户注册
实例411分步用户注册
17.2留言本
实例412简易留言本
实例413留言本(留言分类)
实例414留言本(版主回复)
17.3在线投票系统
实例415网上投票系统(限制多次投票)
实例416网上投票系统(一个IP一月只能投票一次)
17.4论坛
实例417查看帖子信息
实例418发表主题信息
实例419回复主题信息
实例420删除主题及回复信息
实例421安全退出
17.5购物车
实例422添加至购物车
实例423查看购物车
实例424从购物车中移去指定商品
实例425修改商品购买数量
实例426清空购物车
实例427收银台结账
17.6万年历
实例428简易万年历
实例429带有备忘录的万年历
17.7聊天室
实例430Application形式的聊天室
实例431数据库形式的聊天室(10分钟不说话用户下线)
实例432聊天室(私聊)
17.8搜索
实例433一般搜索
实例434高级搜索
实例435常用搜索
技术要点对应实例位置
……

『贰』 用C语言开发简单的应用系统程序,源代码不得少于150行

火车站售票查询系统:

#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int shoudsave=0 ;
int count1=0,count2=0,mark=0,mark1=0 ;
/*定义存储火车信息的结构体*/
struct train
{
char num[10];/*列车号*/
char city[10];/*目的城市*/
char takeoffTime[10];/*发车时间*/
char receiveTime[10];/*到达时间*/
int price;/*票价*/
int bookNum ;/*票数*/
};
/*订票人的信息*/
struct man
{
char num[10];/*ID*/
char name[10];/*姓名*/
int bookNum ;/*需求的票数*/
};
/*定义火车信息链表的结点结构*/
typedef struct node
{
struct train data ;
struct node * next ;
}Node,*Link ;
/*定义订票人链表的结点结构*/
typedef struct people
{
struct man data ;
struct people*next ;
}bookMan,*bookManLink ;
/* 初始界面*/
void printInterface()
{
puts("********************************************************");
puts("* Welcome to use the system of booking tickets *");
puts("********************************************************");
puts("* You can choose the operation: *");
puts("* 1:Insert a train information *");
puts("* 2:Inquire a train information *");
puts("* 3:Book a train ticket *");
puts("* 4:Update the train information *");
puts("* 5:Advice to you about the train *");
puts("* 6:save information to file *");
puts("* 7:quit the system *");
puts("********************************************************");
}
/*添加一个火车信息*/
void InsertTraininfo(Link linkhead)
{
struct node *p,*r,*s ;
char num[10];
r = linkhead ;
s = linkhead->next ;
while(r->next!=NULL)
r=r->next ;
while(1)
{
printf("please input the number of the train(0-return)");
scanf("%s",num);
if(strcmp(num,"0")==0)
break ;
/*判断是否已经存在*/
while(s)
{
if(strcmp(s->data.num,num)==0)
{
printf("the train '%s'has been born!\n",num);
return ;
}
s = s->next ;
}
p = (struct node*)malloc(sizeof(struct node));
strcpy(p->data.num,num);
printf("Input the city where the train will reach:");
scanf("%s",p->data.city);
printf("Input the time which the train take off:");
scanf("%s",p->data.takeoffTime);
printf("Input the time which the train receive:");
scanf("%s",&p->data.receiveTime);
printf("Input the price of ticket:");
scanf("%d",&p->data.price);
printf("Input the number of booked tickets:");
scanf("%d",&p->data.bookNum);
p->next=NULL ;
r->next=p ;
r=p ;
shoudsave = 1 ;
}
}
/*打印火车票信息*/
void printTrainInfo(struct node*p)
{
puts("\nThe following is the record you want:");
printf(">>number of train: %s\n",p->data.num);
printf(">>city the train will reach: %s\n",p->data.city);
printf(">>the time the train take off: %s\nthe time the train reach: %s\n",p->data.takeoffTime,p->data.receiveTime);
printf(">>the price of the ticket: %d\n",p->data.price);
printf(">>the number of booked tickets: %d\n",p->data.bookNum);
}

struct node * Locate1(Link l,char findmess[],char numorcity[])
{
Node*r ;
if(strcmp(numorcity,"num")==0)
{
r=l->next ;
while(r)
{
if(strcmp(r->data.num,findmess)==0)
return r ;
r=r->next ;
}
}
else if(strcmp(numorcity,"city")==0)
{
r=l->next ;
while(r)
{
if(strcmp(r->data.city,findmess)==0)
return r ;
r=r->next ;
}
}
return 0 ;
}

/*查询火车信息*/
void QueryTrain(Link l)

{
Node *p ;
int sel ;
char str1[5],str2[10];
if(!l->next)
{
printf("There is not any record !");
return ;
}
printf("Choose the way:\n>>1:according to the number of train;\n>>2:according to the city:\n");
scanf("%d",&sel);
if(sel==1)
{
printf("Input the the number of train:");
scanf("%s",str1);
p=Locate1(l,str1,"num");
if(p)
{
printTrainInfo(p);
}
else
{
mark1=1 ;
printf("\nthe file can't be found!");
}
}
else if(sel==2)
{
printf("Input the city:");
scanf("%s",str2);
p=Locate1(l,str2,"city");
if(p)
{
printTrainInfo(p);
}
else
{
mark1=1 ;
printf("\nthe file can't be found!");
}
}
}

/*订票子模块*/
void BookTicket(Link l,bookManLink k)
{
Node*r[10],*p ;
char ch,dem ;
bookMan*v,*h ;
int i=0,t=0 ;
char str[10],str1[10],str2[10];
v=k ;
while(v->next!=NULL)
v=v->next ;
printf("Input the city you want to go: ");
scanf("%s",&str);
p=l->next ;
while(p!=NULL)
{
if(strcmp(p->data.city,str)==0)
{
r[i]=p ;
i++;
}
p=p->next ;
}
printf("\n\nthe number of record have %d\n",i);
for(t=0;t<i;t++)
printTrainInfo(r[t]);
if(i==0)
printf("\n\t\t\tSorry!Can't find the train for you!\n");
else
{
printf("\ndo you want to book it?<1/0>\n");
scanf("%d",&ch);
if(ch == 1)
{
h=(bookMan*)malloc(sizeof(bookMan));
printf("Input your name: ");
scanf("%s",&str1);
strcpy(h->data.name,str1);
printf("Input your id: ");
scanf("%s",&str2);
strcpy(h->data.num,str2);
printf("Input your bookNum: ");
scanf("%d",&dem);
h->data.bookNum=dem ;
h->next=NULL ;
v->next=h ;
v=h ;
printf("\nLucky!you have booked a ticket!");
getch();
shoudsave=1 ;
}
}
}
bookMan*Locate2(bookManLink k,char findmess[])
{
bookMan*r ;
r=k->next ;
while(r)
{
if(strcmp(r->data.num,findmess)==0)
{
mark=1 ;
return r ;
}
r=r->next ;
}
return 0 ;
}
/*修改火车信息*/
void UpdateInfo(Link l)
{
Node*p ;
char findmess[20],ch ;
if(!l->next)
{
printf("\nthere isn't record for you to modify!\n");
return ;
}
else
{
QueryTrain(l);
if(mark1==0)
{
printf("\nDo you want to modify it?\n");
getchar();
scanf("%c",&ch);
if(ch=='y');
{
printf("\nInput the number of the train:");
scanf("%s",findmess);
p=Locate1(l,findmess,"num");
if(p)
{
printf("Input new number of train:");
scanf("%s",&p->data.num);
printf("Input new city the train will reach:");
scanf("%s",&p->data.city);
printf("Input new time the train take off");
scanf("%s",&p->data.takeoffTime);
printf("Input new time the train reach:");
scanf("%s",&p->data.receiveTime);
printf("Input new price of the ticket::");
scanf("%d",&p->data.price);
printf("Input new number of people who have booked ticket:");
scanf("%d",&p->data.bookNum);
printf("\nmodifying record is sucessful!\n");
shoudsave=1 ;
}
else
printf("\t\t\tcan't find the record!");
}
}
else
mark1=0 ;
}
}
/*系统给用户的提示信息*/
void AdvicedTrains(Link l)
{
Node*r ;
char str[10];
int mar=0 ;
r=l->next ;
printf("Iuput the city you want to go: ");
scanf("%s",str);
while(r)
{
if(strcmp(r->data.city,str)==0&&r->data.bookNum<200)
{
mar=1 ;
printf("\nyou can select the following train!\n");
printf("\n\nplease select the fourth operation to book the ticket!\n");
printTrainInfo(r);
}
r=r->next ;
}
if(mar==0)
printf("\n\t\t\tyou can't book any ticket now!\n");

}
/*保存火车信息*/
void SaveTrainInfo(Link l)
{
FILE*fp ;
Node*p ;
int count=0,flag=1 ;
fp=fopen("c:\\train.txt","wb");
if(fp==NULL)
{
printf("the file can't be opened!");
return ;
}
p=l->next ;
while(p)
{
if(fwrite(p,sizeof(Node),1,fp)==1)
{
p=p->next ;
count++;
}
else
{
flag=0 ;
break ;
}
}
if(flag)
{
printf("the number of the record which have been saved is %d\n",count);
shoudsave=0 ;
}
fclose(fp);
}
/*保存订票人的信息*/
void SaveBookmanInfo(bookManLink k)
{
FILE*fp ;
bookMan*p ;
int count=0,flag=1 ;
fp=fopen("c:\\man.txt","wb");
if(fp==NULL)
{
printf("the file can't be opened!");
return ;
}
p=k->next ;
while(p)
{
if(fwrite(p,sizeof(bookMan),1,fp)==1)
{
p=p->next ;
count++;
}
else
{
flag=0 ;
break ;
}
}
if(flag)
{
printf("the number of the record which have been saved is %d\n",count);
shoudsave=0 ;
}
fclose(fp);
}

int main()
{
FILE*fp1,*fp2 ;
Node*p,*r ;
char ch1,ch2 ;
Link l ;
bookManLink k ;
bookMan*t,*h ;
int sel ;
l=(Node*)malloc(sizeof(Node));
l->next=NULL ;
r=l ;
k=(bookMan*)malloc(sizeof(bookMan));
k->next=NULL ;
h=k ;
fp1=fopen("c:\\train.txt","ab+");
if((fp1==NULL))
{
printf("can't open the file!");
return 0 ;
}
while(!feof(fp1))
{
p=(Node*)malloc(sizeof(Node));
if(fread(p,sizeof(Node),1,fp1)==1)
{
p->next=NULL ;
r->next=p ;
r=p ;
count1++;
}
}
fclose(fp1);
fp2=fopen("c:\\man.txt","ab+");
if((fp2==NULL))
{
printf("can't open the file!");
return 0 ;
}

while(!feof(fp2))
{
t=(bookMan*)malloc(sizeof(bookMan));
if(fread(t,sizeof(bookMan),1,fp2)==1)
{
t->next=NULL ;
h->next=t ;
h=t ;
count2++;
}
}
fclose(fp2);
while(1)
{
clrscr();
printInterface();
printf("please choose the operation: ");
scanf("%d",&sel);
clrscr();
if(sel==8)
{
if(shoudsave==1)
{
getchar();
printf("\nthe file have been changed!do you want to save it(y/n)?\n");
scanf("%c",&ch1);
if(ch1=='y'||ch1=='Y')
{
SaveBookmanInfo(k);
SaveTrainInfo(l);
}
}
printf("\nThank you!!You are welcome too\n");
break ;

}
switch(sel)
{
case 1 :
InsertTraininfo(l);break ;
case 2 :
QueryTrain(l);break ;
case 3 :
BookTicket(l,k);break ;
case 4 :
UpdateInfo(l);break ;
case 5 :
AdvicedTrains(l);break ;
case 6 :
SaveTrainInfo(l);SaveBookmanInfo(k);break ;
case 7 :
return 0;
}
printf("\nplease press any key to continue.......");
getch();
}
return 0;
}

『叁』 抖音小程序开发

Java仿抖音短视频小程序开发 全栈式实战项目免费下载

链接:https://pan..com/s/1K0b-jeL6U7kolcKSwZL2Yw

提取码:85xy

Java仿抖音短视频小程序开发源码(仿抖音短视频程序开发)是很好用的仿抖音短视频小程序开发的源码。Java仿抖音短视频小程序开发源码功能强大,使用简便,给用户带来很多开发便利

『肆』 开发一个简易的计算器APP程序 Android源代码

下面是效果展示:

复制代码代码如下:


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="s/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tvResult"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:height="50dp"
android:text="@string/tvResult"
/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btnBackspace"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="150dp"
android:layout_marginLeft="10dp"
android:text="@string/btnbackspace"/>
<Button
android:id="@+id/btnCE"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="150dp"
android:text="@string/btnCE"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:width="75dp"
android:text="@string/btn7"/>
<Button
android:id="@+id/btn8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn8"/>
<Button
android:id="@+id/btn9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn9"/>
<Button
android:id="@+id/btnDiv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnDiv"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:width="75dp"
android:text="@string/btn4"/>
<Button
android:id="@+id/btn5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn5"/>
<Button
android:id="@+id/btn6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn6"/>
<Button
android:id="@+id/btnMul"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnMul"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:width="75dp"
android:text="@string/btn1"/>
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn2"/>
<Button
android:id="@+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn3"/>
<Button
android:id="@+id/btnAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnAdd"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:width="75dp"
android:text="@string/btn0"/>
<Button
android:id="@+id/btnC"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnC"/>
<Button
android:id="@+id/btnEqu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnEqu"/>
<Button
android:id="@+id/btnSub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnSub"/>
</LinearLayout>
</LinearLayout>

复制代码代码如下:


package com.example.week2;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.app.Activity;

public class MainActivity extends Activity implements OnClickListener{

//声明一些控件
Button btn0=null;
Button btn1=null;
Button btn2=null;
Button btn3=null;
Button btn4=null;
Button btn5=null;
Button btn6=null;
Button btn7=null;
Button btn8=null;
Button btn9=null;
Button btnBackspace=null;
Button btnCE=null;
Button btnC=null;
Button btnAdd=null;
Button btnSub=null;
Button btnMul=null;
Button btnDiv=null;
Button btnEqu=null;
TextView tvResult=null;
//声明两个参数。接收tvResult前后的值
double num1=0,num2=0;
double Result=0;//计算结果
int op=0;//判断操作数,
boolean isClickEqu=false;//判断是否按了“=”按钮

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//从布局文件中获取控件,
btn0=(Button)findViewById(R.id.btn0);
btn1=(Button)findViewById(R.id.btn1);
btn2=(Button)findViewById(R.id.btn2);
btn3=(Button)findViewById(R.id.btn3);
btn4=(Button)findViewById(R.id.btn4);
btn5=(Button)findViewById(R.id.btn5);
btn6=(Button)findViewById(R.id.btn6);
btn7=(Button)findViewById(R.id.btn7);
btn8=(Button)findViewById(R.id.btn8);
btn9=(Button)findViewById(R.id.btn9);
btnBackspace=(Button)findViewById(R.id.btnBackspace);
btnCE=(Button)findViewById(R.id.btnCE);
btnC=(Button)findViewById(R.id.btnC);
btnEqu=(Button)findViewById(R.id.btnEqu);
btnAdd=(Button)findViewById(R.id.btnAdd);
btnSub=(Button)findViewById(R.id.btnSub);
btnMul=(Button)findViewById(R.id.btnMul);
btnDiv=(Button)findViewById(R.id.btnDiv);
tvResult=(TextView)findViewById(R.id.tvResult);

//添加监听
btnBackspace.setOnClickListener(this);
btnCE.setOnClickListener(this);

btn0.setOnClickListener(this);
btn1.setOnClickListener(this);
btn2.setOnClickListener(this);
btn3.setOnClickListener(this);
btn4.setOnClickListener(this);
btn5.setOnClickListener(this);
btn6.setOnClickListener(this);
btn7.setOnClickListener(this);
btn8.setOnClickListener(this);
btn9.setOnClickListener(this);


btnAdd.setOnClickListener(this);
btnSub.setOnClickListener(this);
btnMul.setOnClickListener(this);
btnDiv.setOnClickListener(this);
btnEqu.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
//btnBackspace和CE--------------------
case R.id.btnBackspace:
String myStr=tvResult.getText().toString();
try {
tvResult.setText(myStr.substring(0, myStr.length()-1));
} catch (Exception e) {
tvResult.setText("");
}

break;
case R.id.btnCE:
tvResult.setText(null);
break;

//btn0--9---------------------------
case R.id.btn0:
if(isClickEqu)
{
tvResult.setText(null);
isClickEqu=false;
}
String myString=tvResult.getText().toString();
myString+="0";
tvResult.setText(myString);
break;
case R.id.btn1:
if(isClickEqu)
{
tvResult.setText(null);
isClickEqu=false;
}
String myString1=tvResult.getText().toString();
myString1+="1";
tvResult.setText(myString1);
break;
case R.id.btn2:
if(isClickEqu)
{
tvResult.setText(null);
isClickEqu=false;
}
String myString2=tvResult.getText().toString();
myString2+="2";
tvResult.setText(myString2);
break;
case R.id.btn3:
if(isClickEqu)
{
tvResult.setText(null);
isClickEqu=false;
}
String myString3=tvResult.getText().toString();
myString3+="3";
tvResult.setText(myString3);
break;
cas

『伍』 源代码到底是什么有什么用

源代码就是用汇编语言和高级语言写出来的代码。主要对象是面向开发者;
我们平常使用的应用程序都是经过源码编译打包以后发布的,呈现的最后结果是面向使用者,最终客户的。

1.理论上的概念
源代码是相对目标代码和可执行代码而言的。
源代码就是用汇编语言和高级语言写出来的代码。
目标代码是指源代码经过编译程序产生的能被cpu直接识别二进制代码。
可执行代码就是将目标代码连接后形成的可执行文件,当然也是二进制的。
2.最直观的概念
在这个网页上右键鼠标,选择查看源文件.出来一个记事本,里面的内容就是此网页的源代码.
===================================================
关于两者的区别联系:
1.从字面意义上来讲,源文件是指一个文件,指源代码的集合.源代码则是一组具有特定意义的可以实现特定功能的字符(程序开发代码).
2."源代码"在大多数时候等于"源文件".
比如在这个网页上右键鼠标,选择查看源文件.出来一个记事本,里面的内容就是此网页的源代码."这句话就体现了他们的关系,此处的源文件是指网页的源文件,而源代码就是源文件的内容,所以又可以称做网页的源代码..

『陆』 什么是源代码

源代码是用特定编程语言编写的人类可读文本,源代码的目标是为可以转换为机器语言的计算机设置准确的规则和规范。因此,源代码是程序和网站的基础。

源代码可以存在于每个软件中,软件按照源代码中的编程进行执行,常用的格式是文本文件,计算机源代码的最终目的是将人类可读的文本翻译成为计算机可以执行的二进制指令,这种过程叫做编译,通过编译器完成。

(6)程序开发范例宝典源码扩展阅读:

概念研究

一、理论上的概念

源代码是相对目标代码和可执行代码而言的。

源代码就是用汇编语言和高级语言写出来的代码。

目标代码是指源代码经过编译程序产生的能被cpu直接识别的二进制代码。

可执行代码就是将目标代码连接后形成的可执行文件,当然也是二进制的。

二、最直观的概念

在这个网页上右键鼠标,选择"查看源文件".出来一个记事本,里面的内容就是此网页的源代码.

关于两者的区别联系:

1、从字面意义上来讲,源文件是指一个文件,指源代码的集合。源代码则是一组具有特定意义的可以实现特定功能的字符(程序开发代码).

2、"源代码"在大多数时候等于"源文件".

比如在这个网页上右键鼠标,选择查看源文件。出来一个记事本,里面的内容就是此网页的源代码."这句话就体现了他们的关系,此处的源文件是指网页的源文件,而源代码就是源文件的内容,所以又可以称做网页的源代码。.

源代码是指原始代码,可以是任何语言代码。

汇编码是指源代码编译后的代码,通常为二进制文件,比如DLL、EXE、.NET中间代码、JAVA中间代码等。

高级语言通常指C/C++、BASIC、C#、JAVA、PASCAL等等汇编语言就是ASM,只有这个,比这个更低级的就是机器语言了。

源程序源文件源代码是一回事。

参考资料来源:网络-源代码

阅读全文

与程序开发范例宝典源码相关的资料

热点内容
桌面经常出现options文件 浏览:436
成龙可以复活的那个电影叫什么 浏览:986
ugt型刀怎么编程铣外圆 浏览:972
win10主题绅士 浏览:319
苹果7p的双镜头怎么用 浏览:439
enbx文件怎么打开 浏览:632
前戏特别长的电影 浏览:348
文件管理的五大职业是指什么 浏览:351
cad桌面应用程序 浏览:998
少女卖春电影 浏览:61
如何复制word整个文件 浏览:632
和谐网站来一个 浏览:80
360wifi微信无法打开图片 浏览:185
下午我打算去看电影的英文 浏览:592
家政app有哪些优势 浏览:537
18g压缩文件如何传输 浏览:559
微信重新登陆好麻烦 浏览:439
第一次男老师和女学生电影 浏览:135
编程指令goo表示什么意思 浏览:901

友情链接