C璇█瀹炵幇鍥涘垯杩愮畻

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C璇█瀹炵幇鍥涘垯杩愮畻相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/%e6%94%b9%e8%bf%9b' title='鏀硅繘'>鏀硅繘   ever   RoCE   ops   reporting   epo   ann   default   鍙傛暟   

Github:https://github.com/YgR9710/Calculation

1. PSP2.1琛ㄦ牸

PSP2.1

Personal Software Process Stages

棰勪及鑰楁椂锛堝垎閽燂級

瀹為檯鑰楁椂锛堝垎閽燂級

Planning

璁″垝

 120

240 

路 Estimate

路 浼拌杩欎釜浠诲姟闇€瑕佸灏戞椂闂?/p>

 100

200

Development

寮€鍙?/p>

 2000

 3000

路 Analysis

路 闇€姹傚垎鏋?(鍖呮嫭瀛︿範鏂版妧鏈?

 200

 300

路 Design Spec

路 鐢熸垚璁捐鏂囨。

 60

 60

路 Design Review

路 璁捐澶嶅 (鍜屽悓浜嬪鏍歌璁℃枃妗?

 60

 60

路 Coding Standard

路 浠g爜瑙勮寖 (涓虹洰鍓嶇殑寮€鍙戝埗瀹氬悎閫傜殑瑙勮寖)

 60

 60

路 Design

路 鍏蜂綋璁捐

 120

 180

路 Coding

路 鍏蜂綋缂栫爜

 1800

 2100

路 Code Review

路 浠g爜澶嶅

 10

 20

路 Test

路 娴嬭瘯锛堣嚜鎴戞祴璇曪紝淇敼浠g爜锛屾彁浜や慨鏀癸級

 60

 60

Reporting

鎶ュ憡

 30

 30

路 Test Report

路 娴嬭瘯鎶ュ憡

 60

 60

路 Size Measurement

路 璁$畻宸ヤ綔閲?/p>

 30

 30

路 Postmortem & Process Improvement Plan

路 浜嬪悗鎬荤粨, 骞舵彁鍑鸿繃绋嬫敼杩涜鍒?/p>

 30

 30

鍚堣

 

 2620

 3370

 

 

2闇€姹傦細

1. 浣跨敤 -n 鍙傛暟鎺у埗鐢熸垚棰樼洰鐨勪釜鏁般€傦紙瀹炵幇锛?/p>

2. 浣跨敤 -r 鍙傛暟鎺у埗棰樼洰涓暟鍊硷紙鑷劧鏁般€佺湡鍒嗘暟鍜岀湡鍒嗘暟鍒嗘瘝锛夌殑鑼冨洿銆傦紙瀹炵幇锛?/p>

3. 鐢熸垚鐨勯鐩腑璁$畻杩囩▼涓嶈兘浜х敓璐熸暟锛屼篃灏辨槸璇寸畻鏈〃杈惧紡涓鏋滃瓨鍦ㄥ舰濡俥1 ? e2鐨勫瓙琛ㄨ揪寮忥紝閭d箞e1 鈮?e2銆傦紙瀹炵幇锛?/p>

4. 鐢熸垚鐨勯鐩腑濡傛灉瀛樺湪褰㈠e1 梅 e2鐨勫瓙琛ㄨ揪寮忥紝閭d箞鍏剁粨鏋滃簲鏄湡鍒嗘暟銆傦紙瀹炵幇锛?/p>

5. 姣忛亾棰樼洰涓嚭鐜扮殑杩愮畻绗︿釜鏁颁笉瓒呰繃3涓€傦紙瀹炵幇

6. 绋嬪簭涓€娆¤繍琛岀敓鎴愮殑棰樼洰涓嶈兘閲嶅锛?strong>鍗充换浣曚袱閬撻鐩笉鑳介€氳繃鏈夐檺娆′氦鎹?/strong>+鍜?/strong>宸﹀彸鐨勭畻鏈〃杈惧紡鍙樻崲涓哄悓涓€閬撻鐩?/strong>銆傦紙瀹炵幇锛?/p>

7.鐢熸垚鐨勯鐩瓨鍏ユ墽琛岀▼搴忕殑褰撳墠鐩綍涓嬬殑Exercises.txt鏂囦欢銆傦紙瀹炵幇锛?/p>

8. 鍦ㄧ敓鎴愰鐩殑鍚屾椂锛岃绠楀嚭鎵€鏈夐鐩殑绛旀锛屽苟瀛樺叆鎵ц绋嬪簭鐨勫綋鍓嶇洰褰曚笅鐨凙nswers.txt鏂囦欢銆傦紙瀹炵幇锛?/p>

9. 绋嬪簭搴旇兘鏀寔涓€涓囬亾棰樼洰鐨勭敓鎴愩€傦紙瀹炵幇锛?/p>

10. 绋嬪簭鏀寔瀵圭粰瀹氱殑棰樼洰鏂囦欢鍜岀瓟妗堟枃浠讹紝鍒ゅ畾绛旀涓殑瀵归敊骞惰繘琛屾暟閲忕粺璁°€傦紙鏈疄鐜帮級

 

3鏁堣兘鍒嗘瀽锛?/h2>

鍦ㄧ敓鎴愯〃杈惧紡鐨勬椂鍊欑敤鍒颁簡涓嬪垪鏁版嵁缁撴瀯锛?/p>

1.閾捐〃

銆€銆€鐢ㄦ潵瀛樺偍鐢熸垚鐨勮〃杈惧紡锛岄€嗘尝鍏板紡

2.鏍?/p>

銆€銆€鐢ㄦ潵鐢熸垚閫嗘尝鍏板紡锛岃绠楅€嗘尝鍏板紡鐨勭粨鏋?/p>

3.浜屽弶鏍?/p>

銆€銆€鐢ㄦ潵妫€鏌ユ槸鍚︽湁閲嶅琛ㄨ揪寮?/p>

 

4璁捐娴佺▼

銆€銆€

5浠g爜璇存槑

銆€銆€1鐢熸垚琛ㄨ揪寮?/p>

int MakeProgression(int n, int m, int line,LTList &ltlist,int k)  //n涓哄彇鍊艰寖鍥达紝m涓鸿繍绠楃涓暟
{
	LkList list, p;
	list = (LkList)malloc(sizeof(LinkList));
	list->next = NULL;
	p = list;
	Elemtype ch, num;
	ch.tag = 1;	
	num.tag = 0;
	num.n.numerator = random(n);
	num.n.denominator = 1;
	num.n.coef = 0;
	MakeList(p, num);
	int i;	
	for (i = 1; i <= m; i++)
	{
		ch.e = op_Symbol[random(4)];				
		num.tag = 0;
		num.n.numerator = random(n);
		num.n.denominator = 1;
		num.n.coef = 0;				
		if (Check1(ch.e, num.n.numerator))continue;
		MakeList(p, ch);
		MakeList(p, num);	
	}	
	LkList RePL, Opl;
	RePL = (LkList)malloc(sizeof(LinkList));
	Opl = (LkList)malloc(sizeof(LinkList));
	RePL->next = NULL;
	Opl->next = NULL;
	if (ReversrPL(list, RePL, Opl) == FALSE)return FALSE;	
	ltlist[k] = Opl;
	int j;
	for (j = 1; j < k; j++)
	{
		if (isRepeat(list, ltlist[j]) == FALSE)return FALSE;
	}
	Elemtype result;
	result.tag = 0;
	if (Caculate(RePL, result) == FALSE)return FALSE;
	ch.e = 鈥?鈥?
	MakeList(p, ch);
	MakeList(p, result);
	p = list->next;
	LkList pp;
	while (p != NULL)
	{
		if (p->elem.tag == 1)printf(" %c ", p->elem.e);
		else if (p->elem.tag == 0)
		{
			printf("%d", p->elem.n.numerator);					
		}
		else if (p->elem.tag == -1)
		{
			printf("%d%c%d%c%d", p->elem.n.coef, p->elem.quo, p->elem.n.numerator, p->elem.e, p->elem.n.denominator);
		}
		if (p->next == NULL)pp = p;
		p = p->next;		
	}
	char str[100];
	strcpy(str, "Exercises.txt");
	WriteFILE(list->next, str, line);
	strcpy(str, "Answers.txt");
	WriteFILE(pp, str, line);
	return TRUE;
}

銆€銆€2.寤虹珛閾捐〃瀛樺偍

void MakeList(LkList &p, Elemtype E)
{
	LkList pt;
	pt = (LkList)malloc(sizeof(LinkList));
	pt->next = NULL;
	pt->elem.tag = E.tag;
	if (E.tag == 1)
	{
		pt->elem.e = E.e;
	}
	else
	{
		pt->elem.n.coef = E.n.coef;
		pt->elem.n.denominator = E.n.denominator;
		pt->elem.n.numerator = E.n.numerator;
	}
	if (E.tag == -1)
	{
		pt->elem.e = E.e;
		pt->elem.quo = E.quo;
	}
	pt->elem.tag = E.tag;
	p->next = pt;
	p = p->next;
	return;
}

銆€銆€3.鐢熸垚閫嗘尝鍏板紡

int ReversrPL(LkList list,LkList &Rpl,LkList &Opl)		//閫嗘尝鍏板紡
{
	LkList p;
	p = list->next;
	Stack s1, s2;
	InitStack(s1, 20);
	InitStack(s2, 20);
	Elemtype E;
	E.e = 鈥?鈥?
	E.tag = 1;
	PushStack(s1, E);
	while (p != NULL)
	{
		if (p->elem.tag != 1)
		{
			PushStack(s2, p->elem);
		}
		else if(p->elem.tag==1)
		{
			if (getPri(p->elem.e) > getPri(s1.elem[s1.top - 1].e))
			{
				PushStack(s1, p->elem);
			}
			else
			{
				while (getPri(p->elem.e) <= getPri(s1.elem[s1.top - 1].e))
				{
					PopStack(s1, E);
					PushStack(s2, E);
				}
				PushStack(s1, p->elem);
			}
		}
		p = p->next;
	}
	while (s1.top != 1)
	{
		PopStack(s1, E);
		PushStack(s2, E);		
	}
	LkList pt;
	pt = Rpl;
	int ns2top = 0;		
	while (ns2top < s2.top)
	{
		MakeList(pt, s2.elem[ns2top++]);		
	}
	LkList pn;	
	pn = Opl;
	while (s2.top > 0)
	{
		PopStack(s2, E);
		MakeList(pn, E);
	}
	s1.elem = NULL;
	s2.elem = NULL;
	return TRUE;
}

銆€銆€4.璁$畻琛ㄨ揪寮忕粨鏋?/p>

int Caculate(LkList Rpl, Elemtype &Result)
{
	Stack s;
	InitStack(s, 20);
	LkList p;
	p = Rpl->next;
	Elemtype t1, t2;
	t1.tag = 0;
	t2.tag = 0;
	while (p != NULL)
	{
		if (p->elem.tag == 0)
		{
			PushStack(s, p->elem);
		}
		else
		{
			PopStack(s, t1);
			PopStack(s, t2);
			switch (p->elem.e)
			{
			case 鈥?鈥?Addition(t2, t1, Result); break;
			case 鈥?鈥?Subtraction(t2, t1, Result); break;
			case 鈥?鈥?Multiplication(t2, t1, Result); break;
			case 鈥?鈥?Division(t2, t1, Result); break;
			default:break;
			}
			if (Result.n.denominator < 0 || Result.n.numerator < 0)return FALSE;
			PushStack(s, Result);
		}
		p = p->next;
	}
	PopStack(s, Result);
	if (Result.n.coef != 0)
	{
		Result.tag = -1;
		Result.quo = 鈥榎鈥樷€?
		Result.e = 鈥?鈥?
	}
		s.elem = NULL;
		return TRUE;	
}

銆€銆€5.妫€鏌ユ槸鍚﹂噸澶?/p>

int isRepeat(LkList ori,LkList cpa)		//妫€鏌ユ槸鍚﹂噸澶?{
	LkList p ,pn;	
	p = ori->next;
	pn = cpa->next;
	pBiTree T1, T2;	
	T1 = CreateBiTree(p);
	T2 = CreateBiTree(pn);
	if (isEqual(T1, T2) == FALSE)return FALSE;
	return TRUE;
}

銆€銆€6.鍐欏叆鏂囦欢

void WriteFILE(LkList List, char*filename ,int i)	//鍐欐枃浠?{
	FILE *fp;
	fp = fopen(filename, "a+");
	if (fp == NULL)
	{
		printf("鏃犳硶鎵撳紑姝ゆ枃浠禱n");
	}
	LkList p;
	p = List;
	char str[20];
	itoa(i, str, 10);
	fputs(str, fp);
	fputc(鈥?鈥? fp);
	while (p != NULL)
	{
		if (p->elem.tag == 1)
		{
			fputc(鈥?鈥? fp);
			fputc(p->elem.e, fp);
			fputc(鈥?鈥? fp);
			if (p->elem.e == 鈥?鈥?break;
		}
		else if (p->elem.tag == 0)
		{
			itoa(p->elem.n.numerator, str, 10);
			fputs(str, fp);
		}
		else if (p->elem.tag == -1)
		{
			itoa(p->elem.n.coef, str, 10);
			fputs(str, fp);
			fputc(p->elem.quo, fp);
			itoa(p->elem.n.numerator, str, 10);
			fputs(str, fp);
			fputc(p->elem.e, fp);
			itoa(p->elem.n.denominator, str, 10);
			fputs(str, fp);
		}
		p = p->next;
	}
	fputs("
", fp);
	fclose(fp);
	return;
}

銆€銆€8.涓诲嚱鏁?/p>

int main(int argc, char*argv[])
{
	RandomSeed();
	void ClearFILE();
	int range, line, cnum;
	range = line = cnum = 0;
	int i, temp;
	for (i = 1; i < argc - 1; i++)
	{
		if (strcmp(argv[i], "-n") == 0)
		{
			line = atol(argv[i + 1]);
		}
		if (strcmp(argv[i], "-r") == 0)
		{
			range = atol(argv[i + 1]);
		}
	}
	if (line == 0)line = MAXNUM;
	if (range == 0)range = MAXNUM;
	/*{
		printf("鏃犲彇鍊艰寖鍥达紝璇疯緭鍏?-r 
");
		return 0;
	}*/	
	LTList ltlist;
	ltlist = (LTList)malloc(sizeof(LkList) * line);
	if (ltlist == NULL)return -1;	
	int loop;
	for (i = 1; i <= line;i++)
	{
		loop = MAXLOOP;
		cnum = random(3) + 1;
		printf("%d. ", i);
		temp = MakeProgression(range, cnum, i, ltlist, i-1);
		while (temp == FALSE && loop >= 0)
		{
			temp = MakeProgression(range, cnum, i, ltlist, i - 1);
			if (--loop < 0)break;
		}
		if (loop < 0)
		{
			printf("ERROR
");
			break;
		}
		printf("
");
	}			
	return 0;
}

銆€銆€

6娴嬭瘯杩愯

 

7椤圭洰灏忕粨

以上是关于C璇█瀹炵幇鍥涘垯杩愮畻的主要内容,如果未能解决你的问题,请参考以下文章

Java浣跨敤swing缁勪欢瀹炵幇绠€鏄撹绠楀櫒

鏁版嵁缁撴瀯-C璇█瀹炵幇-閾炬爤

RabbitMQ瀹樻柟鏁欑▼浜?Work Queues(GOLANG璇█瀹炵幇)

闃舵1 璇█鍩虹+楂樼骇_1-3-Java璇█楂樼骇_02-缁ф壙涓庡鎬乢绗?鑺?鎶借薄绫籣19-鍙戠孩鍖呮渚媉瀹炵幇

娣卞害瀛︿範鍘熺悊璇﹁В鍙奝ython浠g爜瀹炵幇

浠庨浂璧锋瀹炵幇闊充箰鎺ㄨ崘绯荤粺