摘要:
#include#include#include#define size 3struct employee{ char name[6]; //姓名 char num[8]; //编号 char sex[2]; //性别int age; //年龄 char addr[10]; //地址 int money; //工资 char health[4]; //身体健康程度 char cul[4]; //文化程度 }emp[size]; //employee结构体struct employee_type{ char name[6]; int money;}empl[size]; //employee_t
阅读全文
posted @ 2013-07-16 10:35
琥珀玲珑
阅读(444)
推荐(0)
摘要:
fopen(文件名,使用文件的方式):打开数据文件fclose(FILE *fp):关闭数据文件feof(FILE *fp):是判断是否到fp的结尾fputc(char ch,FILE *fp):把ch输入到fp指针所指向的文件中fgetc(FILE *fp):从fp文件中读入一个字符gets(char stu[i]):输入字符串fgets(char stu[i],int n,FILE *fp):从fp指针所指的文件中读入一个长度为n-1的字符串,并存放在数组stu中fputs(char stu[i],FILE *fp):把stu中的字符串写到fp指针所指的文件中fwrite:把此地开始的存储
阅读全文
posted @ 2013-07-13 18:22
琥珀玲珑
阅读(359)
推荐(0)
摘要:
#includeint main(){FILE *fp1,*fp2;fp1=fopen("file1.dat","r"); //打开输入文件fp2=fopen("file2.dat","w"); //打开输出文件while(!feof(fp1)) //feof判断是否到fp1的能结尾putchar(fgetc(fp1)); //从fp1中读入一个字符,并显示在屏幕上putchar(10); //换行功能rewind(fp1); //使文件位置标记返回文件头while(!feof(fp1))fputc(fgetc(f
阅读全文
posted @ 2013-07-13 17:56
琥珀玲珑
阅读(264)
推荐(0)
摘要:
fwrite:把此地开始的存储区中的数据向文件输入格式:fwrite(buffer,size,count,fp)fread:用来存放从文件读入的数据的存储区的数据格式:fread(buffer,size,count,fp)buffer:是一个地址size:要读写的字节大小count:要读写多少个数据项fp:FILE指针类型
阅读全文
posted @ 2013-07-13 10:14
琥珀玲珑
阅读(308)
推荐(0)
摘要:
#include#include#define size 10struct student_type{char name[10];int num;int age; char addr[15];}stu[size]; //全局变量stu数组,包含10个学生void save() //存储功能{ FILE *fp;int i;if((fp=fopen("stu.dat","wb"))==NULL) //打开stu.dat文件{ printf("can't open file!\n");exit(0);//return;}for(i
阅读全文
posted @ 2013-07-13 10:07
琥珀玲珑
阅读(220)
推荐(0)
摘要:
#include#include#includeint main(){FILE *fp;char str[3][10],temp[10]; //定义一个二维数组str和一个临时数组tempint i,j,k,n=3;printf("Enter string:\n");for(i=0;i0)k=j;if(k!=i){strcpy(temp,str[i]);strcpy(str[i],str[k]);strcpy(str[k],temp);}}if((fp=fopen("I:\\string.dat","w"))==NULL) //打开文
阅读全文
posted @ 2013-07-10 18:32
琥珀玲珑
阅读(261)
推荐(0)
摘要:
declare cursor for select语句 --说明游标(创建游标)open --打开游标fetch --推进游标close --关闭游标deallocate --删除游标
阅读全文
posted @ 2013-07-10 09:26
琥珀玲珑
阅读(395)
推荐(0)
摘要:
#include#includeint main(){FILE *in,*out; //定义file指针变量输入in,输出outchar ch,infile[10],outfile[10]; //定义两个字符数组,分别存放in,out文件printf("请输入读入的文件名:");scanf("%s",infile);printf("请输入输出的文件名:");scanf("%s",outfile);if((in=fopen(infile,"r"))==NULL) //以读的方式打开filename
阅读全文
posted @ 2013-07-10 08:32
琥珀玲珑
阅读(275)
推荐(0)
摘要:
#include#includeint main(){FILE *fp;char ch,filename[10];printf("请输入所用的文件名:");scanf("%s",filename);if((fp=fopen(filename,"w"))==NULL) //以读写的方式打开filename文件,并使fp指向此文件{printf("无法打开此文件\n");exit(0);}ch=getchar(); //用于接收最后输入的回车符printf("请输入一个准备存储到磁盘的字符串(“以#结束):&
阅读全文
posted @ 2013-07-10 08:06
琥珀玲珑
阅读(309)
推荐(0)
摘要:
#includestruct //声明无名结构体类型{int num; //编名char name[10]; //姓名char sex; //性别char job; //职业union //声明无名共同体类型{int clas; //班级char position[10]; //职务}category; //共同体变量}person[2]; //定义结构体数组,有两个元素int main(){int i;for(i=0;i<2;i++){printf("please enter the data of person:\n");scanf("%d %s %c
阅读全文
posted @ 2013-07-05 13:10
琥珀玲珑
阅读(332)
推荐(0)
摘要:
#includeint main(){enum Color{red,yellow,blue,white,black}; //声明枚举类型enum Colorenum Color i,j,k,pri; //定义枚举变量i,j,k,priint n,loop;n=0;for(i=red;i<=black;i++)for(j=red;j<=black;j++)if(i!=j){for(k=red;k<=black;k++)if((k!=i)&&(k!=j)){n++; //符合条件加1 printf("%-4d",n); //输出第几个符合条件的
阅读全文
posted @ 2013-07-05 12:03
琥珀玲珑
阅读(741)
推荐(0)
摘要:
bool为布尔型,只有一个字节,取值false和true#includeusing namespace std;int main(){int year;bool leap; //bool为布尔型,只有一个字节,取值false和truecout>year;if(year%4==0){if(year%100==0){if(year%400==0)leap=true; //是闰年elseleap=false; //不是闰年}elseleap=true;}elseleap=false;if(leap) //判断leap的值cout<<year<<" is a l
阅读全文
posted @ 2013-07-02 19:44
琥珀玲珑
阅读(951)
推荐(0)
摘要:
iomainip 控制符#include#includeusing namespace std;int main(){int a;cout>a;cout>b;cout<<"16进制:"<<setiosflags(ios::uppercase)<<setbase(16)<<b<<endl; //输出a的16进制,输出字母X时以大写表示double pi=22.0/7.0;cout<<setiosflags(ios::scientific)<<setprecision(8); //用
阅读全文
posted @ 2013-07-02 12:07
琥珀玲珑
阅读(305)
推荐(0)
摘要:
一.概念模型:即信息模型,用于数据库设计 二.数据模型: 1.逻辑模型:层次模型(树),网状模型(图),关系模型(存储数据),面向对象模型,对象关系模型等。2.物理模型:是面向计算机系统的。
阅读全文
posted @ 2013-07-01 11:50
琥珀玲珑
阅读(187)
推荐(0)
摘要:
模式的定义与删除一、定义模式(createschema):在SQL中,语句如下: createschema模式名authorization用户名备注:1、如果没有模式名,那么模式名就隐含为用户名。 2、“authorization”是“授权”的意思。意即授权给该用户“用户名”定义一个名为“模式名”的模式。 【例一】定义一个学生—课程模式即S—T createschema“S—T”authorizationwang意即用户wang定义了一个模式S—T 定义模式实际上是定义了一个命名空间,在这个空间里可以进一步定义该模式包含的数据库对象,例如:基本表、视图、索引等。二、删除模式(dropschem
阅读全文
posted @ 2013-07-01 11:42
琥珀玲珑
阅读(496)
推荐(0)