head=NULL;
while((str[i]=getchar())!=.)
{ if(str[i]>=A&& str[i]<=Z|| str[i]>=a&& str[i]<=z) { p=head;
while(p!=NULL)
if(p->c==str[i]) break; else { q=p; p=p->next; } if(p==NULL)
{ p=(struct node *)malloc(sizeof(struct node)); p->c=str[i];
p->next=NULL;
if(head==NULL) head=p; else q->next=p; } } i++; }
p=head;
while(p!=NULL)
{ printf(,,p->c); p=p->next; } }
*11һУԭͷβԭβͷ
⣺#include <>
struct link { int data; struct link *next;}; struct link *f(struct link *head)
{ struct link *p,*q,newhead=NULL,*s;
while(head->next!=NULL) { p=head;
while(p->next!=NULL) { q=p; p=p->next;}
if(newhead==NULL) newhead=p; else s->next=p; s=p;
q->next=NULL; }
s->next=head;
return newhead; }
ϰ 10
һбʽֵ 13&6 212&7 33|9 402||12 5x=13^9 615/2^1 714 815/3 97<<2 109<<2 11x=13>>2 129>>3 ⣺(1) 3&6 ֵΪ 2 (2) -12&7 ֵΪ 4 (3) 3|9 ֵΪ 11 (4) -02||12 ֵΪ 1 (5) (x=13)^9 ֵΪ 4 (6) 15/2^1 ֵΪ 6 (7) ~-14 ֵΪ 13 (8) ~15/3 ֵΪ -5 (9) 7<<2 ֵΪ 28 (10) -9<<2 ֵΪ -36 (11) (x=13)>>2 ֵΪ 3 (12) -9>>3 ֵΪ C2
䡰short abֱдִabֵ 1a=2b=7a&b 2a=3b=a|4 3a=5b=a<<2 4a=15b=a>>2 ⣺(1) aΪ 2bΪ 7 (2) aΪ -3bΪ C3
(3) aΪ 5bΪ 20 (4) aΪ -15bΪ 3
дг 1
#include <> int main(void) { union
{ char s[2]; int i; }g;
=0x4142;
printf(\
printf(\ [0]=1; [1]=0;
printf(\
return 0; }
⣺=4142
[0]=42 g.s[1]=41 =1
2
#include <> void main()
{ union { char n[12];int m[4];double x[2];} a; printf(\ }
⣺16
3
void main() {
int x=3,y=9; x=x^y; y=x^y; x=x^y;
printf(\
}
⣺9,3
4
#include <>
void swp(int *x,int *y) {
*x=*x^*y;
*y=*x^*y; *x=*x^*y;
} void main() {
int a,b,i;
for(i=0;i<4;i++){
scanf(\ swp(&a,&b);
printf(\
} }
ʱ룺
9 C9L 8 4L 1 C5L 23 C1L
⣺-9,9
4,8 -5,1 -1,23
ġ
1һĻ롣
⣺#include <> void main() { int a;
scanf(%d,&a); printf(%xH,a);
}
2һ8λȫΪ18λԭʮ
⣺#include <> void main() { int a;
scanf(%d,&a); a|=0xff;
printf(%xH,a);
}
3һַɾַезǺֵַַ
⣺#include <> #include <>
void main() { char str[81]; int i; gets(str);
for(i=0;str[i]!=\\0;)
if((str[i]&0x80)==0) strcpy(str+i,str+i+1); else i++; puts(str);
}
*4. ıļܡһıһֵԸıܺģֵܺԭġ
⣺#include <> void main() { char s[81]; int m1,m2,i; printf(Ҫܵı\\n);
gets(s); 00һո
ʾοַд뵽ʱļ.ʱдһոʱļ
⣺#include <> #include <> void main()
{ FILE *fp1,*fp2;
char str[81],name[80],c;
printf(ļ); gets(name);
if((fp1=fopen(name,r))==NULL)
{ printf(ܴļ%s !,name); exit(0); } if((fp2=fopen(d:\\\\,w))==NULL)
{ printf(ܴļd:\\\\!); exit(0); } while((c=getc(fp1))!=EOF) { fputc(c,fp2);
if(c==.) putc( ,fp2); }
fclose(fp1); fclose(fp2); remove(name);
rename(d:\\\\,name); fp1=fopen(name,r);
while(fgets(str,80,fp1)!=NULL) puts(str); fclose(fp1); }