博文

[置顶] Borland Turbo C++3.0头文件及函数分类(2007-09-05 20:10:00)

摘要:一、输入输出子程序,函数库为io.h、conio.h、 stdio.h(一) io.h文件创建 _creat  creat   creatnew  creattemp  文件打开  open  _open    sopen文件关闭 _close   close 文件读写 read   _read    _write    write文件尾测试    eof  文件长度测试  filelength文件指针移动与获取  lseek  tell 文件更名移动与删除  rename  remove  unlink  文件锁定与解锁  lock  unlock  文件句柄复制 dup  dup2 文件时间设置和获取   setftime  getftime  access  _chmod  chmod  chsize  ioctl   isatty  locking mktemp  setmode umask   (二) conio.h清屏 clrscr  窗口定义 window 光标定位 gotoxy   wherex   wherey  输入输出  cscanf  cprintf   cgets   cputs  getch  putch  getche   gette......

阅读全文(24) | 评论:0

股票参数分析(2008-03-11 20:15:00)

摘要:MFI资金流量指标 1.MFI>80 为超买,当其回头向下跌破80 时,为短线卖出时机; 2.MFI<20 为超卖,当其回头向上突破20 时,为短线买进时机; 3.MFI>80,而产生背离现象时,视为卖出信号; 4.MFI<20,而产生背离现象时,视为买进信号。         股标下跌时,MFI曲线下滑,中途出现小阳线时,如果阳不能克阴,MFI曲线的方向不会转变,这就意味着此时的价入是危险的,后面可能还会有更多的跌盘出现,因此股价下跌中的小阳线反弹介入是危险的。        当MFI下跌小于20时,是否就到了股价的底部呢?回答是否定的,股价的底部形成是多种多样的,不能仅凭MFI的值来确认底部,关键还是要看均线系统,如果5日、10日、20日均线已经收扰,股价小幅上扬,MFI值达到50-60时逢低进场,等待股价上涨是个不错的选择。        真正的股票行情,一般都是出现在MFI大于60以上时,不论上涨时间多长,MFI大于60以上是行情最好的时候,而当股价达到顶峰急剧下跌时,MFI在顶部反复也会下跌到60附近。  BIAS乖离率 作为抓短线的一个重要指标,乖离率......

阅读全文(36) | 评论:0

c语言函数应用及解释(2007-09-08 16:15:00)

摘要:判断一个文件是否存在5楼所说的用access()来判断一个文件是否存在,的确简单高效,在此多谢了.int  _Cdecl access   (const char *path, int amode); 请问5楼int amode中的值有哪些,分别代表什么含义?#include <stdio.h>#include <stdlib.h>#include <io.h>int main(int argc, char *argv[]){  printf("%d",access("c:\\dev-cpp\\packman.exe" ,0));  //文件存在返回0,否则返回-1   system("PAUSE");      return 0;} 格式问题:%g 选择常规方式或科学计数法输出。有效数字自然是6位以下四条,由上而下看是否成立整数部分7位或以上,科学计数法整数部分大于0且不足7位,常规整数部分为0,小数部分7位或以上,科学计数法整数部分为0,小数部分不足7位,常规printf("%g\n", 111.11111111); 输出111.111printf("%g", 0.0000111); 输出1.11e-005printf("%g", 0.00011); 输出0.00011printf("%g", 12.000011); 输出12(因为后面的两个1不是有效数字)%f 浮点数%u 无符号整数%I64d __int64…… 字符串函数比较:http://www.ggv.com.cn/forum/clib/string/strset.html......

阅读全文(50) | 评论:0

C语言变长参数问题(2007-09-08 10:36:00)

摘要:#include <stdarg.h> //不定长参数要包含这个#include <stdio.h>int findMax(int count, ...){    int num, max=-2147483648, tmp;    va_list arg_ptr; //指向参数列表    va_start(arg_ptr, count); //从count参数开始    for (; count>0; count--)    {        num=va_arg(arg_ptr, int);        if (num>max) max=num;    }    va_end arg_ptr; //释放空间    return num;}void main() {     int x;    x=findMax(4,-2,3,-111,678,999); //4是要处理的int个数,即999不处理    printf("%d", x);} 再说一点,函数不知道参数的个数,所以,前面要有个参数告诉函数参数的个数比如,printf,是通过%s %d之类的个数来确定后面的参数个数的还有,省略号是三个英文的 句号 ,只能出现在参数末尾!这点......

阅读全文(26) | 评论:0

创建随日期变化的文件名(2007-09-07 12:11:00)

摘要://以下是调试好的一段程序,供你参考,大虾们考虑用日期做文件名有没有意义,我觉得如此讨论还不如给你段代码可能更有意义,就当我自己复习了一遍。//要了解时间的获取,请查阅以下网址://http://www.xrss.cn/Info/14539.Html#include <stdio.h> //printf(),fopen(),fclose()#include <io.h> #include <conio.h> //getch(),clrscr()#include <time.h>  //时间函数定义 time_t,struct tm#include <string.h>#include <stdlib.h> //类型转换函数库,如itoa()#define NULL 0int main(){   clrscr();  //清屏   char fname[50],year[5],month[3],day[3]; //定义文件名,年月日   FILE *fp; //声明文件指针   struct tm *local; //声明时间结构指针   time_t t;  //声明时间变量   t=time(NULL); //最1900年以来至现在的秒数   local=localtime(&t); //t里的秒数通过localtime函数转换为年月日时分秒等整数存到结构tm中,指针变量为local   printf("%d/%d/%d\n",local->tm_year+1900,local->tm_mon+1,local->tm_mday)......

阅读全文(71) | 评论:0

C语言的文件操作(2007-09-02 21:46:00)

摘要:#include <sys\stat.h> #include <string.h> #include <fcntl.h> #include <io.h> int main(void) {    int handle;   //句柄方式   char buf[11] = "0123456789";    /* change the default file mode from text to binary */    _fmode = O_BINARY;    /* create a binary file for reading and writing */    handle = creat("DUMMY.FIL", S_IREAD | S_IWRITE);    /* write 10 bytes to the file */    write(handle, buf, strlen(buf));    /* close the file */    close(handle);    return 0; } #include <stdio.h> int main(void) {    FILE *fp;   //指针方式   char ch;    /* open a file for writing */    fp = fopen("DUMMY.FIL", "w");    /* force an error condition by attempting to read */    ch = fgetc(fp);    printf("%c\n",ch);    if (ferror(fp))    {   ......

阅读全文(32) | 评论:0

VB用ADO操作数据库方法集锦(2007-08-30 00:37:00)

摘要:http://www.programbbs.com/doc/466.htmhttp://www.kehui.net/html/article/26/26769.htmlhttp://www.yesky.com/imagesnew/software/ado/index.html 一、引用ADO部件 要使用ADO操作数据库,首先必须将“Microsoft ActiveX data objects 2.0 library”引入工程,在VBA中,是通过“工具/引用”菜单,在VB中,是通过“工程/引用”菜单调出对话框,然后在左侧列表中找到该项并将其前面的选择框选中。 二、创建ADO对象 方法一: dim ... as 方法  dim conn as adodb.connection '连接对象  dim cmd as adodb.command     '命令对象  dim para as adodb.parameters '参数对象  dim rs as adodb.recordset    '数据集对象 方法二: set ... new 方法  set conn = new adodb.connection  set cmd = new adodb.command  set para = new adodb.parameters  set rs = new adodb.recordset 三、创建数据库连接   dim strconn as string  strconn = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=database;Data Source=servername"  '指定连接字符串  conn.ConnectionString = strconn               conn.O......

阅读全文(93) | 评论:0

矩阵蛇形填数(2007-08-18 22:59:00)

摘要:/* 6. 矩阵中填数. 当给出 N*N 的矩阵,要求用程序填入下列形式的数:   ① 倒填,例如N=5             ② 蛇形填数              ③ 回转填数 ┌─┬─┬─┬─┬─┐   ┌─┬─┬─┬─┬─┐   ┌─┬─┬─┬─┬─┐ │25│24│23│22│21│   │ 1│ 3│ 4│10│11│   │ 1│16│15│14│13│ ├─┼─┼─┼─┼─┤   ├─┼─┼─┼─┼─┤   ├─┼─┼─┼─┼─┤ │20│19│18│17│16│   │ 2│ 5│ 9│12│19│   │ 2│17│24│23│12│ ├─┼─┼─┼─┼─┤   ├─┼─┼─┼─┼─┤   ├─┼─┼─┼─┼─┤ │15│14│13│12│11│   │ 6│ 8│13│18│20│   │ 3│18│25│22│11│ ├─┼─┼─┼─┼─┤   ├─┼─┼─┼─┼─┤   ├─┼─┼─┼─┼─┤ │10│ 9│ 8│ 7│ 6│   │ 7│14│17│21│24│  &......

阅读全文(32) | 评论:0

3. 打印一个 N*N 的方阵,N为每边字符的个数(2007-08-18 22:57:00)

摘要:3. 打印一个 N*N 的方阵,N为每边           N=15  打印出下面图形 字符的个数(3<N<20), 要求最               TTTTTTTTTTTTTTT 外一层为"T", 第二层为"J", 从第三层               TJJJJJJJJJJJJJT 起每层依次打印数字 1,2,3,...                     TJ11111111111JT (右图以N为15为例)                           TJ12222222221JT                                       ......

阅读全文(57) | 评论:0

c语言磁盘路径函数练习(2007-08-18 22:54:00)

摘要://磁盘路径函数练习#include <stdio.h>#include <dir.h>  //chdir() mkdir() getcwd()#include <ctype.h>int main(){   int getcurdir(char *path,int nbuffersize);   char path[255];   getcurdir(path,255);   chdir("c:\\");   getcurdir(path,255);   mkdir("c:\\lx");      //int mkdir(char *pathname)   chdir("c:\\lx");      //int chdir(const char *pathname)   getcurdir(path,255);   chdir("c:\\");   rmdir("c:\\lx");      //int rmdir(char *pathname)   getcurdir(path,255);   getcurdir(path,255);}int getcurdir(char *path,int nbuffersize){   getcwd(path,nbuffersize);  //getcwn(char *cbuffer,&......

阅读全文(99) | 评论:0