找工作的收获

     前天学校来了第一个招聘公司,参加了它的笔试和面试,虽然最后失败了,我觉得有必要将这些经验记录下来,但是因为有考试所以一直没有时间写,今天终于有时间了,就写下来了,用以自勉!

     笔试时,选择了开发工程师,所以考了编程题,没看到传说的所谓的行测题,有点小高兴!编程题考了3道,第一道是编写一个关于数组升序或降序的算法,第二题是数列1、1、2、3、5、8······求第N个值,第三题是给一个字符串从中找出相同的字母,并计算相同字母的个数。再打第一道题的时候就范了致命的错误,直接导致最后的失败,这点值得检讨。当时看到题时心中窃喜,因为大多数已经做过,或做过类似的,所以轻忽了过程。在答第一道题时升序和降序方式不同,我给彻底忘了,就变了一个符号。第二题我没有用递归算法,而是用了普通的方法,经验证应该是对的。第三题以前做过。

    面试的时候,考官先让我们看我们笔试的卷子,希望我们继续改进,。我当时拿到卷子特别紧张,以至于都没好好看,也没想想为什么我一定因为有错才得了75分,这就注定了我的失败。所以回答考官的问题时有点迷茫。考官说我第一题就是错的,当时心想这次面试肯定是不行了。后来考官又问int是多少位的,当时觉得int的位数应该不是准确的,应该与机器有关。最后考官问假如int是16位的,那么如何把前八位与后八位兑换呢。这个时候我已经慌了,就说用与或非加移位符号,但是具体执行的方式,得考虑一下。总之答的是一塌糊涂。最终真的就没有过。

   通过这次面试让我收获不少。首先,在笔试完了之后,我回寝室应该马上上机执行一遍,看看有没有错误,这样第二天面试的时候有了准备就不会这么轻易地失败了。第二,基础知识还是要好好掌握的,我答卷的时候竟然将srtiing类的使用方法给忘了。第三,面试的时候太过与紧张,发挥的不是很好。

   这是我第一次参见招聘,对自己认识还有些不够,虽然以失败告终,但是也获得了宝贵的经验!!!

下面附上3道题的代码:

1

#include <iostream>

#define SORTUP    1
#define SORTDOWN  2

void swap(int array[], int i,int j,int temp);
void display(int array[], int n);

void sort(int array[], int n, int num)
{
	using std::endl;
	using std::cout;

	cout << "The array without sort :" << endl;
	display(array,n);
	cout << "--------------------------------" <<endl;
	if(num == SORTUP)
	{
		for(int i = 0; i < n; i++)
		{
			for(int j = 0; j < i; j++)
			{
				if(array[i] < array[j])
					swap(array, i, j, array[i]);
				//display(array, n);
			}
				
		}
	}
	else if(num == SORTDOWN)
	{
		for(int i = 0; i < n; )
		{
			int temp = array[i];
			for(int k =i,  j = i; j < n; j++)
			{
				if(temp < array[j])
				{
					int temp1 = 0;
					temp1 = array[k];
					array[k] = array[j];
					array[j] = temp1;
					k = j;
					//display(array, n);
				}
			}
			if(temp == array[i])
			{
				i++;
			}
		}
	}
	display(array, n);
}


void swap(int array[], int i, int j, int temp)
{
	while(i > j)
	{
		array[i] = array[i-1];
		i--;
	}
	array[j] = temp;
}

void display(int array[], int n)
{
	using std::cout;
	using std::endl;

	for(int i = 0; i < n; i++)
	{
		cout << array[i] << " " ;
	}
	cout << endl;
}

int main()
{
	using std::cout;
	using std::cin;

	int array[10] = {3, 2, 5, 8, 4, 0, 6, 9, 1, 7};
	cout << "If you want to sort the number with ascending order Please enter the number 1"
		<< ",\nor you want to sort the number with descending order Please enter the number 2: ";
	int num ;
	cin >> num;
	sort(array, 10, num);
	return 10;

}


 

2

 

#include <iostream>

int calculate(int num)
{
	using std::cerr;
	using std::endl;
	int a = 0;
	int result = 1;
	if(1 == num)
		return result;
	else if(num > 1)
	{
		for (int i = 2; i <= num; i++)
		{
			int b = a;
			a = result;
			result = a + b;
			
		}
		return result;
	}
	else 
		cerr << "error! " << endl;
	return -1;

}


int main()
{
	using std::cin;
	using std::cout;
	using std::endl;
	int num;
	cout << "Enter the number you want to calculate: " ;
	cin >> num;
	cout << "The result of the calculation is " << calculate(num) << endl;
	return 0;
}


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值