动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > C/C++教程
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ C/C++教程 ]的信息

本月文章推荐
.C++ Builder 初学问与答(八).
.VC实现系统热键激活后台服务程序.
.深度探索C++对象模型(9).
.C语言入门之分支结构(1).
.用TreeView浏览目录.
.Raw Socket(原始套接字)实现Sn.
.我编的国旗图形.
.C语言入门之联合.
.恺撒的规化.
.Another way to handle array in.
.用 c 写 CGI 程序简要指南.
.C++的编写约瑟夫(josephus)环函数.
.C++中动态内存分配引发问题的解决.
.指针数组.
.VC中解决两个难懂的安全性问题.
.Building Into The Linux Networ.
.慎用url重写.
.C++子对象和堆对象.
.websphere新建C/C++客户机.
.C++对象布局及多态之虚成员函数调.

C语言库函数(T类字母)

发表日期:2008-3-8 |


   
函数名: tan 
功  能: 正切函数 
用  法: double tan(double x); 
程序例: 

#include <stdio.h> 
#include <math.h> 

int main(void) 

   double result, x; 

   x = 0.5; 
   result = tan(x); 
   printf("The tan of %lf is %lf\n", x, result); 
   return 0; 

  
  
  

函数名: tanh 
功  能: 双曲正切函数 
用  法: double tanh(double x); 
程序例: 

#include <stdio.h> 
#include <math.h> 

int main(void) 

   double result, x; 

   x = 0.5; 
   result = tanh(x); 
   printf("The hyperbolic tangent of %lf is %lf\n", x, result); 
   return 0; 

  
  
  
  

函数名: tell 
功  能: 取文件指针的当前位置 
用  法: long tell(int handle); 
程序例: 

#include <string.h> 
#include <stdio.h> 
#include <fcntl.h> 
#include <io.h> 

int main(void) 

   int handle; 
   char msg[] = "Hello world"; 

   if ((handle = open("TEST.$$$", O_CREAT  O_TEXT  O_APPEND)) == -1) 
   { 
      perror("Error:"); 
      return 1; 
   } 
   write(handle, msg, strlen(msg)); 
   printf("The file pointer is at byte %ld\n", tell(handle)); 
   close(handle); 
   return 0; 

  
  
  
  

函数名: textattr 
功  能: 设置文本属性 
用  法: void textattr(int attribute); 
程序例: 

#include <conio.h> 

int main(void) 


   int i; 

   clrscr(); 
   for (i=0; i<9; i++) 
   { 
       textattr(i + ((i+1) << 4)); 
       cprintf("This is a test\r\n"); 
   } 

   return 0; 

  
  
  

函数名: textbackground 
功  能: 选择新的文本背景颜色 
用  法: void textbackground(int color); 
程序例: 

#include <conio.h> 

int main(void) 

   int i, j; 

   clrscr(); 
   for (i=0; i<9; i++) 
   { 
       for (j=0; j<80; j++) 
         cprintf("C"); 
       cprintf("\r\n"); 
       textcolor(i+1); 
       textbackground(i); 
   } 

   return 0; 

  
  
  

函数名: textcolor 
功  能: 在文本模式中选择新的字符颜色 
用  法: void textcolor(int color); 
程序例: 
#include <conio.h> 

int main(void) 

   int i; 

   for (i=0; i<15; i++) 
   { 
       textcolor(i); 
       cprintf("Foreground Color\r\n"); 
   } 

   return 0; 

  
  
  

函数名: textheight 
功  能: 返回以像素为单位的字符串高度 
用  法: int far textheight(char far *textstring); 
程序例: 

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

int main(void) 

   /* request auto detection */ 
   int gdriver = DETECT, gmode, errorcode; 

   int y = 0; 
   int i; 
   char msg[80]; 

   /* initialize graphics and local variables */ 
   initgraph(&gdriver, &gmode, ""); 

   /* read result of initialization */ 
   errorcode = graphresult(); 
   if (errorcode != grOk)  /* an error occurred */ 
   { 
      printf("Graphics error: %s\n", grapherrormsg(errorcode)); 
      printf("Press any key to halt:"); 
      getch(); 
      exit(1); /* terminate with an error code */ 
   } 

   /* draw some text on the screen */ 
   for (i=1; i<11; i++) 
   { 
      /* select the text style, direction, and size */ 
      settextstyle(TRIPLEX_FONT, HORIZ_DIR, i); 

      /* create a message string */ 
      sprintf(msg, "Size: %d", i); 

      /* output the message */ 
      outtextxy(1, y, msg); 

      /* advance to the next text line */ 
      y += textheight(msg); 
   } 

   /* clean up */ 
   getch(); 
   closegraph(); 
   return 0; 

  
  
  

函数名: textmode 
功  能: 将屏幕设置成文本模式 
用  法: void textmode(int mode); 
程序例: 

#include <conio.h> 

int main(void) 

   textmode(BW40); 
   cprintf("ABC"); 
   getch(); 

   textmode(C40); 
   cprintf("ABC"); 
   getch(); 


   textmode(BW80); 
   cprintf("ABC"); 
   getch(); 

   textmode(C80); 
   cprintf("ABC"); 
   getch(); 

   textmode(MONO); 
   cprintf("ABC"); 
   getch(); 

   return 0; 

  
  

函数名: textwidth 
功  能: 返回以像素为单位的字符串宽度 
用  法: int far textwidth(char far *textstring); 
程序例: 

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

int main(void) 

   /* request auto detection */ 
   int gdriver = DETECT, gmode, errorcode; 
   int x = 0, y = 0; 
   int i; 
   char msg[80]; 

   /* initialize graphics and local variables */ 
   initgraph(&gdriver, &gmode, ""); 

   /* read result of initialization */ 
   errorcode = graphresult(); 
   if (errorcode != grOk)  /* an error occurred */ 
   { 
      printf("Graphics error: %s\n", grapherrormsg(errorcode)); 
      printf("Press any key to halt:"); 
      getch(); 
      exit(1); /* terminate with an error code */ 
   } 

   y = getmaxy() / 2; 

   settextjustify(LEFT_TEXT, CENTER_TEXT); 
   for (i=1; i<11; i++) 
   { 
      /* select the text style, direction, and size */ 
      settextstyle(TRIPLEX_FONT, HORIZ_DIR, i); 

      /* create a message string */ 
      sprintf(msg, "Size: %d", i); 

      /* output the message */ 

      outtextxy(x, y, msg); 

      /* advance to the end of the text */ 
      x += textwidth(msg); 
   } 

   /* clean up */ 
   getch(); 
   closegraph(); 
   return 0; 

  
  

函数名: time 
功  能: 取一天的时间 
用  法: logn time(long *tloc); 
程序例: 

#include <time.h> 
#include <stdio.h> 
#include <dos.h> 

int main(void) 

   time_t t; 

   t = time(NULL); 
   printf("The number of seconds since January 1, 1970 is %ld",t); 
   return 0; 

  
  
  

函数名: tmpfile 
功  能: 以二进制方式打开暂存文件 
用  法: FILE *tmpfile(void); 
程序例: 

#include <stdio.h> 
#include <process.h> 

int main(void) 

   FILE *tempfp; 

   tempfp = tmpfile(); 
   if (tempfp) 
      printf("Temporary file created\n"); 
   else 
   { 
      printf("Unable to create temporary file\n"); 
      exit(1); 
   } 

   return 0; 

  
  
  

函数名: tmpnam 
功  能: 创建一个唯一的文件名 
用  法: char *tmpnam(char *sptr); 
程序例: 

#include <stdio.h> 

int main(void) 

   char name[13]; 

   tmpnam(name); 
   printf("Temporary name: %s\n", name); 
   return 0; 

  
  
  

函数名: tolower 
功  能: 把字符转换成小写字母 
用  法: int tolower(int c); 

程序例: 

#include <string.h> 
#include <stdio.h> 
#include <ctype.h> 

int main(void) 

   int length, i; 
   char *string = "THIS IS A STRING"; 

   length = strlen(string); 
   for (i=0; i<length; i++) 
   { 
       string[i] = tolower(string[i]); 
   } 
   printf("%s\n",string); 

   return 0; 

  
  

函数名: toupper 
功  能: 把字符转换成大写字母 
用  法: int toupper(int c); 
程序例: 

#include <string.h> 
#include <stdio.h> 
#include <ctype.h> 

int main(void) 

   int length, i; 
   char *string = "this is a string"; 

   length = strlen(string); 
   for (i=0; i<length; i++) 
   { 
      string[i] = toupper(string[i]); 
   } 

   printf("%s\n",string); 

   return 0; 

  
  

函数名: tzset 
功  能: UNIX时间兼容函数 
用  法: void tzset(void); 
程序例: 

#include <time.h> 
#include <stdlib.h> 
#include <stdio.h> 

int main(void) 

   time_t td; 

   putenv("TZ=PST8PDT"); 
   tzset(); 
   time(&td); 
   printf("Current time = %s\n", asctime(localtime(&td))); 
   return 0; 

上一篇:C语言库函数(U类字母) 人气:494
下一篇:C语言库函数(S类字母)-2 人气:521
浏览全部C/C++的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-10-10 企业网站智能管理系统(TZIMS) v6
2008-10-10 拓文asp.net网站内容管理系统 v6
2008-10-10 动网论坛PHP版 v2.0++ Build 081
2008-10-10 免费时代CMS v5.0
2008-10-10 wodig第四季中文DIGG社区 v4.1 b
2008-10-10 老Y文章管理系统 v2.2 bulid 081
2008-10-10 魔法盒动感相册 ASP+SQL版 v2.0
2008-10-10 Asoft签到管理系统 v3.0 Pack1
2008-10-10 哥特人音乐网潮流留言本 v1.1
2008-10-11 联系人分组工具 v1.1 中文破解版
2008-10-11 FaceMelter变脸 v2.0 汉化破解版
2008-10-11 PathTracker道路跟踪仪 v1.2 破解
2008-10-11 Rooms手机聊天室 v0.6.7 破解版
2008-10-11 RemoteDesktop远程桌面 v1.0 破解
2008-10-11 ProRemote远程调音台 v1.0.1 破解
2008-10-11 PicShare照片共享 v1.0.0 破解版
2008-10-11 Photogene照片编辑器 v1.5 汉化破
2008-10-11 WriteRoom共享文档 v1.0 破解版
  发表评论
姓 名: 验证码:
内 容:
站长工具:网站收录查询 | Google PR查询 | ALEXA排名查询 | CSS在线编辑器 | 广告代码 | js/vbs加密 | md5加密 | 进制转换 | UTF-8 转换工具 | Html转换js | Html转换asp | Html转换php | Html转换perl
实用工具:汉字翻译拼音 | 拼音字典 | 符号对照表 | 个税计算 | 实时汇率查询换算 | 经典小工具 | 汉字简繁转换 | 普通单位换算 | 公制单位换算 | 生辰老黄历 | 国内电话区号 | 国家代码与域名缩写 | 文字加密解密 | 健康查询 | 万年历 | 汉字横竖排版 | 手机号码查询 | 计算器 | ip搜索
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号