C/C++——小编谈C语言函数那些事(23)
C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
1. settextstyle函数
settextstyle函数的功能是为图形输出设置当前的文本属性,其用法为:void far settextstyle (int font, int direction, char size);程序实例如下:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
char *fname[] = { "DEFAULT font",
"TRIPLEX font",
"SMALL font",
"SANS SERIF font",
"GOTHIC font"
};
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
int style, midx, midy;
int size = 1;
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk) /
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
settextjustify(CENTER_TEXT, CENTER_TEXT);
for (style=DEFAULT_FONT; style<=GOTHIC_FONT; style++)
{
cleardevice();
if (style == TRIPLEX_FONT)
size = 4;
settextstyle
相关文档:
操作系统:linux debian 4.0, python版本2.5
s1:安装python2.5-dev。因为Python.h是在dev包中才有。
test@debian:~/test_python_c$ aptitude search python2.5-dev
p python2.5-dev - Header files and a static library for Python.
test@debian:~/test_python_c$ sudo aptitude install python2 ......
羊绒被是以山羊绒为原材料针织物而成的床上用品,依据纱线种类分成粗纺织品和精纺针织物两种,依据原材料比值可以分成纯羊绒及羊绒混纺两种经加工而成的生活用品,供暖性好,盖着舒坦,尽显高档咀嚼。 本文来源:甘肃庆阳腾达商贸 ......
某些场合,如游戏开发,工程计算中,可能需要计算反三角函数,下面是计算反正切三角函数的c源代码实例:
atan_self(double x)
{
//atan(x)=x-x^3/3+x^5/5-x^7/7+.....(-1<x<1)
//return:[-pi/2,pi/2]
double mult,sum,xx;
sum=0;
if(x==1){
return pi/4;
}
if(x==-1){
return -pi/4;
}
((x&g ......
题目:输入三个字符串a,b和c,将a中b的第一次出现替换为c。
代码:
#include <iostream.h>
#include <string.h>
/*字符串替换,第一个参数为原串,第二个参数为要匹配的子串
第三个参数为要替换的第一个子串中包含第二个子串的部分*/
char *strReplace(char *str1,char *str2,char *str3);
void main() ......