高普考 寫出的程式給分標準(程設 資結) - 普考
By Caitlin
at 2013-05-09T00:18
at 2013-05-09T00:18
Table of Contents
高普考 寫出的程式給分標準(of 程設 資結)
請問前輩們 高普考 寫出的程式給分標準(of 程設 資結)? 由於本人程式
能力弱, 寫出的程式常會有一些問題 都會導致不能run , or run出結果錯誤
(因邏輯錯 or 沒宣告記憶體...or .... ), 所以想請教前輩這些錯誤示會如何
扣分? 謝謝!
比如說題目要用(c寫出stack by 鏈結)題目配分八分, 以下是個較正確解答
, 如果我手寫出的程式有很多小問題
* 少了個 } 或if(a==10)卻寫程 if(a=10) =>會扣幾分?
* 沒配置記憶體 : new_node = (LStack)malloc(sizeof(SNode))=>會扣幾分?
* top = new_node寫成 top->next = new_node;=>會扣幾分?
=>會全扣嗎? 因為run不出正確結果
*程式太亂, 沒縮排....會扣幾分?
"define.h":
struct Node { /* °iA|﹐`AIao?A§i */
int data; /* Ax|s°iA|﹐eRA */
struct Node *next; /* ?u|V?U?@﹐`AI */
};
typedef struct Node SNode; /* °iA|﹐`AIao·s??oA */
typedef SNode *LStack; /* |e|C°iA|ao·s??oA */
LStack top = NULL; /* °iA|3?oYao?u?D */
/* ca?H﹐eRA??oAao?T§@‥c?A?A§i */
extern int isStackEmpty();
extern void push(int d);
extern int pop();
/* μ{|!?d‥O: Main.c */
#include <stdio.h>
#include <stdlib.h>
#include "define.h"
void push(int d) {
LStack new_node; /* ·s﹐`AI?u?D */
/* °t﹐m﹐`AI°O?DAe */
new_node = (LStack)malloc(sizeof(SNode));
new_node->data = d; /* ?O¥s﹐`AI?oRe */
new_node->next = top; /* ·s﹐`AI?u|V-i?}cl */
top = new_node; /* ·s﹐`AI|‥?°°iA|?}cl */
}
/* ‥c?A: ±q°iA|‥u¥X﹐eRA */
int pop() {
LStack ptr; /* ?u|V°iA|3?oY */
int temp;
if ( !isStackEmpty() ) { /* °iA|?O§_?OaAao */
ptr = top; /* ?u|V°iA|3?oY */
top = top->next; /* °iA|?u?D?u|V?U﹐`AI */
temp = ptr->data; /* ‥u¥X﹐eRA */
free(ptr); /* AA|^﹐`AI°O?DAe */
return temp; /* °iA|‥u¥X */
}
else return -1;
}
int main(void){
..............
}
--
Tags:
普考
All Comments
By Isla
at 2013-05-13T09:36
at 2013-05-13T09:36
By Necoo
at 2013-05-15T07:58
at 2013-05-15T07:58
By Aaliyah
at 2013-05-15T12:28
at 2013-05-15T12:28
By Tracy
at 2013-05-18T18:40
at 2013-05-18T18:40
By Ida
at 2013-05-21T21:47
at 2013-05-21T21:47
Related Posts
請推薦適合普考財稅行政的考前衝刺班
By John
at 2013-05-08T20:49
at 2013-05-08T20:49
101年普考法律廉政考題
By Freda
at 2013-05-07T18:33
at 2013-05-07T18:33
103水利會桃園區灌管組上榜心得
By Emily
at 2013-05-07T15:48
at 2013-05-07T15:48
快考試了,卻驀然發現心理學真的好廣....
By Rebecca
at 2013-05-07T12:14
at 2013-05-07T12:14
請問年底地方特考會招考吗
By Anthony
at 2013-05-07T07:21
at 2013-05-07T07:21