您当前的位置:首页 > 职场资讯 > 面试秘籍

SONY

来源:11保定人才网 时间:2019-01-22 作者:11保定人才网 浏览量:

1.完成下列程序


*
*.*.
*..*..*..
*...*...*...*...
*....*....*....*....*....
*.....*.....*.....*.....*.....*.....
*......*......*......*......*......*......*......
*.......*.......*.......*.......*.......*.......*.......*.......
#include
#define N 8
int main()
{
int i;
int j;
int k;
---------------------------------------------------------
| |
| |
| |
---------------------------------------------------------
return 0;
}


2.完成程序,实现对数组的降序排序


#include
void sort( );
int main()
{
int array[]={45,56,76,234,1,34,23,2,3}; //数字任//意给出
sort( );
return 0;
}
void sort( )
{
____________________________________
| |
| |
|-----------------------------------------------------|
}


3.费波那其数列,1,1,2,3,5……编写程序求第十项。可以用递归,也可以用其
他方法,但要说明你选择的理由。


#include
int Pheponatch(int);
int main()
{
printf("The 10th is %d",Pheponatch(10));
return 0;
}
int Pheponatch(int N)
{
--------------------------------
| |
| |
--------------------------------
}


4.下列程序运行时会崩溃,请找出错误并改正,并且说明原因。


#include
#include
typedef struct{
TNode* left;
TNode* right;
int value;
} TNode;
TNode* root=NULL;
void append(int N);
int main()
{
append(63);
append(45);
append(32);
append(77);
append(96);
append(21);
append(17); // Again, 数字任意给出
}
void append(int N)
{
TNode* NewNode=(TNode *)malloc(sizeof(TNode));
NewNode->value=N;

if(root==NULL)
{
root=NewNode;
return;
}
else
{
TNode* temp;
temp=root;
while((N>=temp.value && temp.left!=NULL) || (N !=NULL
))
{
while(N>=temp.value && temp.left!=NULL)
temp=temp.left;
while(N temp=temp.right;
}
if(N>=temp.value)
temp.left=NewNode;
else
temp.right=NewNode;
return;
}
}

 


分享到:
上一篇: IBM 下一篇: 华为
相关推荐
客服服务热线
0312-2339711
13933895613
工作日 9:00-19:00
官方微信

Copyright C 20092014 All Rights Reserved 定州锦文科技 冀ICP备17008983号-5

地址:河北省定州市北城区大道观街 电话(Tel):0312-2339711 EMAIL:jwkj@dzjwkj.com

用微信扫一扫