C/C++——С±à̸CÓïÑÔº¯ÊýÄÇЩÊÂ(25)
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. setwritemodeº¯Êý
setwritemodeº¯ÊýµÄ¹¦ÄÜÊÇÉèÖÃͼÐη½Ê½Ï»ÏßµÄÊä³öģʽ£¬ÆäÓ÷¨Îª£ºvoid far setwritemode(int mode);³ÌÐòʵÀýÈçÏ£º
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main()
{
int gdriver = DETECT, gmode, errorcode;
int xmax, ymax;
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
xmax = getmaxx();
ymax = getmaxy();
setwritemode(XOR_PUT);
line(0, 0, xmax, ymax);
getch();
line(0, 0, xmax, ymax);
getch();
setwritemode(COPY_PUT);
line(0, 0, xmax, ymax);
getch();
closegraph();
return 0;
}
2. signalº¯Êý
signalº¯ÊýµÄ¹¦ÄÜÊÇÉèÖÃijһÐźŵĶÔÓ¦¶¯×÷£¬ÆäÓ÷¨Îªint signal(int sig, sigfun fname);³ÌÐòʵÀý´úÂëÈçÏ£º
#pragma inline
#include <stdio.h>
#include <signal.h>
void Catcher(int sig, int type, int *reglist)
{
printf("Caught it!\n");
*(reglist + 8) = 3;
}
int main(void)
{
signal(SIGFPE, Catcher);
asm mov ax,07FFFH
asm in
Ïà¹ØÎĵµ£º
1.1= Óë ==
Àý1£º
±¾ÀýÖÐÑ»·Óï¾äµÄ±¾ÒâÊÇÌø¹ýÎļþÖеĿոñ·û¡¢ÖƱí·û¡¢»»Ðзû
while(c=''||c=='\t'||c=='\n')
c=getc(f);
c= ''||c=='\t'||c=='\n'
ËÀÑ»·
Àý2£º
if((filedesc==open(argv[i],0))<0)
error();
ÓÀÔ¶²»»á±»µ÷ÓÃ
1.2 & ºÍ | ²»Í¬ÓÚ&& ºÍ||
1.3 CÓ ......
ijЩ³¡ºÏ£¬ÈçÓÎÏ·¿ª·¢£¬¹¤³Ì¼ÆËãÖУ¬¿ÉÄÜÐèÒª¼ÆËã·´Èý½Çº¯Êý£¬ÏÂÃæÊǼÆËã·´ÕýÇÐÈý½Çº¯ÊýµÄ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 ......
#include <stdio.h>
int main()
{
char *str[] = {"welcome", "to", "fortemedia", "nanjing"};
char **p = str + 1;
str[0] = ( *p++ ) + 2;
str[1] = * ( p + 1 );
str[2] = p[1] + 3;
str[3] = p[0] + ( str[2] - str[1] );
printf ( "%s\n", str[0] );
printf ( ......