CHGPAL.CPP
上传用户:wszmarenbt
上传日期:2013-04-26
资源大小:2552k
文件大小:1k
源码类别:

Windows编程

开发平台:

Visual C++

  1. #include<graphics.h>
  2. #include<conio.h>
  3. #include<stdio.h>
  4. void main(void)
  5. {
  6. int driver=DETECT,mode;
  7. int NUM1,NUM2,C1,C2;
  8. int X=10,Y=10,COLOR;
  9. int COLOR_NUM[]={0,1,2,3,4,5,20,7,56,57,58,59,60,61,62,63};
  10. char MASSAGE[100];
  11. registerbgidriver(EGAVGA_driver);
  12. initgraph(&driver,&mode,"");
  13. for (COLOR=1; COLOR<=16; COLOR++)
  14. {
  15. setcolor(COLOR);
  16. sprintf(MASSAGE,"Color:%d",COLOR);
  17. outtextxy(X,Y,MASSAGE);
  18. X+=70;
  19. if(X>600)
  20. {
  21. Y+=20;
  22. X=10;
  23. }
  24. }
  25. printf("nnnnnn");
  26. printf("Which color do you want to change? Input it:");
  27. scanf("%d",&C1);
  28. printf("Which color do you want to change it into?Input it:");
  29. scanf("%d",&C2);
  30. setpalette(C1,COLOR_NUM[C2]);
  31. outtextxy(100,250,"The RESULT is :");
  32. setcolor(C1);
  33. sprintf(MASSAGE,"Color:%d",C1);
  34. outtextxy(250,250,MASSAGE);
  35. getch();
  36. outtextxy(100,400,"Press Any Key to EXIT... ...");
  37. getch();
  38. closegraph();
  39. }