码迷,mamicode.com
首页 > 其他好文 > 详细

界面颜色设置

时间:2014-07-24 22:26:42      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   os   strong   io   art   for   

#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");

 }

 

bubuko.com,布布扣

界面颜色设置,布布扣,bubuko.com

界面颜色设置

标签:style   blog   color   os   strong   io   art   for   

原文地址:http://www.cnblogs.com/thrive/p/3866285.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!