91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡(jiǎn)介

c語(yǔ)言寫的大數(shù)計(jì)算器,可用于計(jì)算10^100數(shù)量級(jí)的數(shù)據(jù),可用于計(jì)算加法,乘法,冪次等,主要是算法的實(shí)現(xiàn)思路。

資源截圖

代碼片段和文件信息

/*?Extended?precision?integer?calculator
?*?Implements?+?*?and?^?(power?of)?operations
?*
?*?Skeleton?code?written?by?Jianzhong?Qi?March?2018
?*
?*/

#include?
#include?
#include?
#include?

#define?INT_SIZE 100 /*?max?number?of?digits?per?integer?value?*/
#define?LINE_LEN 103 /*?maximum?length?of?any?input?line?*/
#define?NUM_VARS 10 /*?number?of?different?huge?int?“variables“?*/

#define?ASN_OP ‘=‘ /*?assignment?operator?*/
#define?ECH_OP ‘?‘ /*?echo?operator?*/
#define?ADD_OP ‘+‘ /*?addition?operator?*/
#define?MUL_OP ‘*‘ /*?multiplication?operator?*/
#define?POW_OP ‘^‘ /*?power?of?operator?*/

#define?OPR1_POS 1 /*?position?of?the?first?operand?*/
#define?OPR2_POS 3 /*?position?of?the?second?operand?*/
#define?OP_POS 2 /*?position?of?the?operator?*/

#define?CH_ZERO ‘0‘ /*?character?0?*/

#define?EXIT_CMD? “exit“ /*?command?to?exit?*/
#define?PROMPT “>?“ /*?command?prompt?*/
#define?CMT_FLAG ‘%‘ /*?indicator?for?comment?line?*/

typedef?int?digit_t; /*?a?decimal?digit?*/
typedef?digit_t?huge_t[INT_SIZE]; /*?one?huge?int?“variable“?*/

/*?add?your?constant?and?type?definitions?here?*/

/****************************************************************/

/*?function?prototypes?*/
void?read_line(char?*line?int?max_len);
void?init(huge_t?vars[]?int?lens[]);
void?echo(huge_t?vars[]?int?lens[]?int?opr1_index);
void?assign(huge_t?vars[]?int?lens[]?int?opr1_index?char?*opr2_str);
void?add(huge_t?vars[]?int?lens[]?int?opr1_index?char?*opr2_str);
void?multiply(huge_t?vars[]?int?lens[]?int?opr1_index?char?*opr2_str);
void?power(huge_t?vars[]?int?lens[]?int?opr1_index?char?*opr2_str);

/*?add?your?function?prototypes?here?*/

/****************************************************************/

/*?main?function?controls?all?the?action?do?NOT?modify?this?function?*/
int
main(int?argc?char?*argv[])?{
char?line[LINE_LEN+1]; /*?to?hold?the?input?line?*/
huge_t?vars[NUM_VARS]; /*?to?hold?10?huge?integers?*/
int?lens[NUM_VARS]; /*?to?hold?the?length?of?the?10?vars?*/

int?opr1_index; /*?index?of?the?first?operand?in?command?*/
char?op; /*?operator?in?command?*/

init(vars?lens);

while?(1)?{
printf(PROMPT); /*?print?prompt?*/
read_line(line?LINE_LEN); /*?read?one?line?of?command?*/

if?(line[0]?==?CMT_FLAG)?{ /*?print?comment?in?the?test?data?*/
printf(“%s\n“?line); /*?used?to?simplify?marking?*/
continue;
}

if?(strcmp(line?EXIT_CMD)?==?0)?{ /*?see?if?command?is?“exit“?*/
return?0;
}

opr1_index?=?line[OPR1_POS]?-?CH_ZERO;/*?first?var?number?at?line[1]?*/
op?=?line[OP_POS]; /*?operator?at?line[2]?*/

if?(op?==?ECH_OP)?{ /*?print?out?the?variable?*/
echo(vars?lens?opr1_index);
continue;
}

/*?do?the?calculation?second?operand?starts?at?line[3]?*/
if?(op?==?ASN_OP)?{
assign(vars?lens?opr1_index?line+OPR2_POS);
}?else?i

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????8142??2018-04-16?22:13??calc.c
?????文件???????37446??2018-04-16?22:13??calc.exe
?????文件????????8924??2018-04-16?22:13??calc.o
?????文件????????2639??2018-04-16?22:10??測(cè)試結(jié)果(1).jpg
?????文件???????13504??2018-04-16?22:10??測(cè)試結(jié)果.jpg

評(píng)論

共有 條評(píng)論