首页 > 代码库 > 界面颜色设置

界面颜色设置

#include<stdio.h>#include<stdlib.h>#include <Windows.h> //改变颜色需要void selectSort(int a[],int length);void main(){      HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);  //引入    int i;    float start=0,finish=0;    int a[10]={10,15,4,2,5,3,6,9,7,1};    SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED);  //设置屏幕背景及字体颜色    //system("color 01");    //全局改变颜色    printf("排序前:\n");    for(i=0;i<10;i++)      printf("%d ",a[i]);   SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN);   // system("color 09");    printf("\n排序后:\n");    selectSort(a,10);   } void selectSort(int a[],int length) {   int i,j,temp;   for(i=0;i<length-1;i++)       for(j=i+1;j<length;j++)       {           if(a[i]>a[j])           {               temp=a[i];               a[i]=a[j];               a[j]=temp;           }    }       for(i=0;i<length;i++)           printf("%d ",a[i]);       printf("\n"); }