广联达软件开发笔试题
来源:互联网 发布:梁红 张昕宇 知乎 编辑:程序博客网 时间:2024/05/22 04:24
1.[编程]给定一个整数,获得它的逆序数,如整数87231,逆序后为13278
// nixushu.cpp : Defines the entry point for the console application.////思路是先转成字符串再操作#include "stdafx.h"#include <string>#include <iostream>//返回值为计算出的逆序数int fun(int num){char an[20];int len, t, neg = 0;//len:字符串的长度,t:交换临时变量,此种情况定义成int和char是一样的if(num < 0){num = -num;neg = 1;//看来neg是标识num是否为负数,如果为负数,只计算整数部分}sprintf(an, "%d", num);//把一个格式化数据写到字符串中len = strlen(an);//返回字符串的长度for(int i = 0; i < len/2; i++)//前后交换{t = an[i];an[i] = an[len-1-i];an[len-1-i] = t;}num = atoi(an);//把字符串转换成整数等return neg?-num:num;}int _tmain(int argc, _TCHAR* argv[]){int num = 0;std::cin>>num;std::cout<<fun(num)<<std::endl;return 0;}
// nixushu2.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>int _tmain(int argc, _TCHAR* argv[]){std::cout<<"输出方式2"<<std::endl;int num;std::cin>>num;for(; num > 0; num = num/10){std::cout<<(num%10);}return 0;}
2.[编程]两个无序链表A和B,将其合并为递增排列的一个链表
#include<stdio.h>#include<stdlib.h>struct stud/*定义链表*/{int data;struct stud *next;};void pai_xue(struct stud *head1,struct stud *head2,int count1,int count2)/*冒泡排序法*/{int i,j,temp=0;struct stud *p;for(i=0;i<count1-1;++i) for(p=head1->next;p->next!=NULL;p=p->next)/*对链表1进行排序*/ { if(p->data>p->next->data) { temp=p->data; p->data=p->next->data; p->next->data=temp; } } for(i=0;i<count2-1;++i) for(p=head2->next;p->next!=NULL;p=p->next)/*对链表2进行排序*/ { if(p->data>p->next->data) { temp=p->data; p->data=p->next->data; p->next->data=temp; } } printf("\n链表1排完序后\n");/*输出链表1和2*/ p=head1->next; while(p) { printf("%d",p->data); p=p->next; } printf("\n"); printf("\n链表2排完序后\n"); p=head2->next; while(p) { printf("%d",p->data); p=p->next; } printf("\n"); }void main(){struct stud *head1,*head2,*p,*q,*head3;int count1=1,count2=1;head3=(struct stud *)malloc(sizeof(struct stud *));/*定义链表头结点,并分配空间*/head3->next=NULL;head1=(struct stud *)malloc(sizeof(struct stud *));head2=(struct stud *)malloc(sizeof(struct stud *));p=(struct stud *)malloc(sizeof(struct stud *));q=(struct stud *)malloc(sizeof(struct stud *));head1->next=NULL;head2->next=NULL;printf("输入一个数据以999结束\n");scanf("%d",&p->data);while(p->data!=999)/*链表1输入数据*/{count1++;p->next=head1->next;head1->next=p;printf("输入一个数据以999结束\n");p=(struct stud *)malloc(sizeof(struct stud *));scanf("%d",&p->data);}printf("现在开始给第二个链表输入数据\n");printf("输入一个数据以999结束\n");scanf("%d",&q->data);while(q->data!=999)/*链表2输入数据*/{count2++;q->next=head2->next;head2->next=q;printf("输入一个数据以999结束\n");q=(struct stud *)malloc(sizeof(struct stud *));scanf("%d",&q->data);}pai_xue(head1,head2,count1,count2);head1=head1->next;head2=head2->next;while(head1!=NULL&&head2!=NULL)/*将排序好的链表1和2 的数据导入链表3*/{ if(head1->data<=head2->data) { p=head1->next; head1->next=head3->next; head3->next=head1; head1=p; } else { q=head2->next; head2->next=head3->next; head3->next=head2; head2=q; }}if(head1!=NULL)/*如果有链表1或2的数据不为空,将剩下的数据导入链表3中*/{ p=head1; while(p!=NULL) { q=p->next; p->next=head3->next; head3->next=p; p=q; } }if(head2!=NULL){ q=head2; while(q!=NULL) { p=q->next; q->next=head3->next; head3->next=q; q=p; }}q=head3->next;/*将链表倒置,原来是由大到小,倒置成由小到大*/head3->next=NULL;while(q!=NULL){ p=q->next; q->next=head3->next; head3->next=q; q=p;}printf("两个链表合并后由小到大为\n");p=head3->next;while(p){printf("%d",p->data);p=p->next;}}
3.[编程]找出两个排序数组的合集,如[1,3,4,5,6],[3,5,7,9],合集是[3,5],用一种高效的方法编程实现
4.[编程]将一个句子的单词反过来(单词原样),比如"i am cheating"变成"cheating am i"
5.[设计]有一个遥控,有四个按钮,编号为0,1,2,3,其中0,2控制电器1和电器2的开,1,3控制电器1,2的关,设计一个系统,要求能够开关客厅的电视和卧室的灯,设计一个系统,设计相关的类,要求具有较好的扩展性,最好采用UML方式,或者描述类的主要属性和关键操作
论述题:描述自己在开发过程解决的一个最成功的问题,描述这个问题,并说明是用什么方法、途径解决的,给出必要的数据结构和算法
- 广联达软件开发笔试题
- 广联达软件开发笔试题
- 阿里巴巴软件开发笔试题
- 嵌入式软件开发笔试题
- 腾讯软件开发笔试题 武汉
- 百度2015软件开发工程师笔试题
- 四达时代软件开发笔试题
- 北京华宇软件开发笔试题
- vivo软件开发笔试编程题:
- 嵌入式软件开发经典笔试题
- 软件开发工程师(JAVA)笔试题A
- 软件开发工程师(JAVA)笔试题
- Java软件开发工程师笔试题(答案)
- 嵌入式软件开发笔试
- 腾讯2014软件开发笔试
- 嵌入式软件开发:笔试总结
- [动态规划] 广联达2017校园招聘 软件开发工程师笔试题
- 2011金山软件-服务端开发工程师(JAVA)部分笔试题
- ACM学习-POJ-1003-Hangover
- 拓扑排序
- 关于下载Android源码是无法获取repo和更新Android SDK的错误
- 简介网络请求的结构
- 数据结构经典排序---二路归并排序
- 广联达软件开发笔试题
- UVA - 11137 Ingenuous Cubrency
- notepad++ Function List 插件
- Flex中switch语句实例
- Flex中的if...else if...else语句
- 基础类的DSP/BIOS API调用
- 一些Linux软件(杂)
- 启动BIOS 做了些什么
- RISC与CISC比较