zoukankan      html  css  js  c++  java
  • C++ 预处理器

    C++ 预处理器
    预处理器是一些指令,指示编译器在实际编译之前所需完成的预处理。

    所有的预处理器指令都是以井号(#)开头,只有空格字符可以出现在预处理指令之前。预处理指令不是 C++ 语句,所以它们不会以分号(;)结尾。

    我们已经看到,之前所有的实例中都有 #include 指令。这个宏用于把头文件包含到源文件中。

    C++ 还支持很多预处理指令,比如 #include、#define、#if、#else、#line 等,让我们一起看看这些重要指令。

     1 #include <iostream>
     2 
     3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
     4 using namespace std;
     5 int main(int argc, char** argv) {
     6     void select_sort(int array[],int n);
     7     int a[10],i;
     8     cout<<"enter the originl array:"<<endl;
     9     for(i=0;i<10;i++)
    10     cin>>a[i];
    11     cout<<endl;
    12     
    13     select_sort(a,10);
    14     cout <<"the sorted array:"<<endl;
    15     for(i=0;i<10;i++)
    16     cout <<a[i]<<" ";
    17     cout <<endl;
    18     return 0;
    19 }
    20 
    21 void select_sort(int array[],int n)
    22 {
    23     int i,j,k,t;
    24     for(i=0;i<n-1;i++)
    25     {
    26         k=i;
    27         for(j=i+1;j<n;j++)
    28         if(array[j]<array[k])
    29         k=j;
    30         t=array[k];
    31         array[k]=array[i];
    32         array[i]=t;
    33     }
    34 }
  • 相关阅读:
    每日汇报
    每周总结
    构建之法阅读笔记2
    每周总结
    每周总结
    体温上报软件开发
    体温上报软件开发
    构建之法阅读笔记1
    体温上报软件开发
    大二下学期团队项目(爬取豆瓣电影)
  • 原文地址:https://www.cnblogs.com/borter/p/9401301.html
Copyright © 2011-2022 走看看