易截截图软件、单文件、免安装、纯绿色、仅160KB

C队列 输出杨辉三角


也是中软笔试的算法题,当时并不知道叫杨辉三角,唉。N年不用了,还得再拾起,为了那个梦。
#include <stdio.h>
void main()
{
    int a[50][50];
    int i,j,n;
    printf("Please input Number:");
    scanf("%d",&n);
    for (i=0;i<n;i++)
    {
        for (j=0;j<=i;j++)
        {
            if (j==0 ||j==i)
                a[i][j]=1;
            else
                a[i][j]=a[i-1][j-1]+a[i-1][j];
            printf("%5d",a[i][j]);
        }
        printf("\n");
    }
    getch();
}
/*TC 2.0测试*/
#define size 100
#define true 1
   #define false 0
    typedef int elemtype;
    typedef struct queue
     {
       elemtype element[size];
      int front;
       int rear;}queue;/*jie gou ti*/
    void initqueue(queue*q)
    {
       q->front=q->rear=0;}/*chu shi hua*/
    int enqueue(queue*q,int x)
    {
       if((q->rear+1)%size==q->front)
        return(false);
         q->element[q->rear]=x;
          q->rear=(q->rear+1)%size;
      &nb


相关文档:

c程序的预处理,编译,连接过程。

自己搜集并且整理,用于参考。
1.完整流程:
C源程序头文件-->预编译处理(cpp)-->编译程序本身-->优化程序-->汇编程序-->链接程序-->可执行文件
 
 
 
pic from http://edmulroy.portbridge.com/oview.htm
 
2. c的预处理
预编译程序所完成的基本上是对源程序的& ......

hexdump s 0 n 52 C实例 helloworld

[root@localhost test]# hexdump -s 0 -n 52 -C helloworld
00000000  7f 45 4c 46 01 01 01 00  00 00 00 00 00 00 00 00  |.ELF............|
00000010  02 00 03 00 01 00 00 00  10 83 04 08 34 00 00 00  |............4...|
00000020  30 08 00 00 00 00 00 00  34 00 20 ......

构建自己的C/C++插件开发框架

——初步设想
 最近一直在学习OSGI方面的知识。买了一本《OSGI原理和最佳实践》,可是还没有到。遗憾的是,OSGI目前的几个开源框架只支持Java,对C和C++都不支持的。可惜我们公司目前主要的开发语言还是c和c++,即便是引进OSGI,所得的好处范围有限。而我对松散耦合的模块化开发向往已久。查了一下OSGI对C++支 ......

在C和C++中把标准输出重定向到指定文件

C++的实现
#include<fstream>  
#include <iostream>
using namespace std;
int main()
{  
 ofstream logTest("foo.log");    
 streambuf *oldbuf = cout.rdbuf(logTest.rdbuf());   
  
 cout << "输出 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号