分享

軟體開發

電話
大〇生
案件已認證
有提供電話
地區台北市 文山區
金額顧客預算:一萬以下
其他交件時限:急件: 三天內
RD 工作 web 接案 Programmer 工作

您需要開發的項目是?

其他, 學校作業

您希望使用哪種程式語言?

C/C++

您需要其他服務嗎?

其他, 就把這題寫出來就好

您的項目目前狀態為?

其他, 大二生找專題教授

[選填] 簡單說明軟體內容、設計目的、期望目標或其他所需要的設計細節

Description. The engineering calculator serves as a handy tool for performing calculations related to complex formulas. The following instructions provide tips for implementing the basic functionality of the calculator. Now, follow these instructions and proceed to code the calculator. 1. Design a calculator that can evaluate any expressions. ( ※ Include +, -, *, /, (, ), ^ ) [Ex.] ( 1.2 + 2.3 ) * ( ( 3.4 / 4.5 ) / ( ( - 0.6 ) + 7 * ( 1 - 1 ) ) ) ^ 2 [Ans.] 5.55007 2. Extend the calculator such that it can deal with sin, cos, tan, exp, log ... etc. ( ※ The units for sin and cos are degrees, and the base used for log is 10. ) [Ex.] sin ( cos 0 + 89 ) + cos 90 - log ( 1000 / 10 ) + exp 2 [Ans.] 6.38906 Note. You can implement more symbols, but please include at least all the symbols mentioned above. 3. Extend the calculator such that the program can handle multiple statements and print out the values for all variables. [Ex.] int a, b, c ; float d, e ; // integer variables // float variables a = 5 ; b = 7 ; c = ( 12 + 23 ) / ( a + 12 ) * ( b + 8 ) ; d = c + 1.2 + sin 45 ; e = d + b * 5.6 ; [Ans.] ( a, b, c, d, e ) = ( 5, 7, 30, 31.907, 71.107 ) Note. We can ensure that the variable types are limited to int and float, and the calculated float results should be rounded to 3 decimal places. Requirements. 1. Implement your program using C or C++ 2. Your program can be executed in two ways: A. After your user execute your program, let the user choose the mode. If the user chooses Direct Mode, you have to let the user type in formula then output the result on terminal. [Ex.] {Assume that your program named “calculator”} $ ./calculator Choose your mode: direct sin 90 + cos 0 2 B. The other mode user can choose is the File Mode. In this one you will let the user type input file name, output file name respectively. Do the calculation on input file then output them on output file. [Ex.] {Assume that your program named “calculator”} $ ./calculator Choose your mode: file Input file name: input.txt Output file name: output.txt 3. The file format for input and output will only be *.txt 4. User could add comment by using //, or /*, */ . Please remove it before starting your calculation methods. 5. If the user encounters any illegal errors (as divide 0, using variable unassigned, wrong symbols), please output an error message (the format can be arbitrary). 6. Please write a README or Report to introduce how to use your program and provide information on its implementation Examples. 1. Direct Computation Mode In [1]:./calculator Choose your mode: Direct 0+1 Out[1]:1 In [2]:./calculator Choose your mode: direct tan(90) Out[2]:infinity * The format of Infinity can be arbitrary In [3]:./calculator -d Choose your mode: direct 0++3 Out[3]:error * The format of error can be arbitrary In [4]:./calculator Choose your mode: direct 2 ^ 2 * exp ( 1.0 + 2.0 / 2 ) + 3.14159 * sin ( 89 + cos ( -0.0 )) Out[4]:403.142 2. File Mode In [1]:./calculator Choose your mode: file Input file name: in1.txt Output file name: out1.txt in1.txt: * Remember remove the comments int a, b, c; // integer variables float d,e ; // float variables a = 5 ; b = 7 ; c = (12 +23) / (a + 12) * (b + 8); d = c + 1.2 + sin 45; e = d + b * 5.6; out1.txt: (a, b, c, d, e) = (5, 7, 30, 31.907, 71.107) * The format of output can be arbitrary In [2]:./calculator Choose your mode: file Input file name: in2.txt Output file name: out2.txt in2.txt: * Remember remove the comments int a, b; /* integer variables */ float f, g, d, h, c; /* float variables */ a = 5 ; b = 7 ; c = (12 +23) / (a + 12) * (b + 8); d = (exp2+32)/6; f = c + 1.2 + sin 45; g = d + b * 5.6; out2.txt: (a, b, f, g, d, h, c) = (5, 7, 32.789, 61.200, 22.000, 0.000, 30.882) * The format of output can be arbitrary Hints. 1. If you encounter difficulties dealing with string-related issues, such as unnecessary whitespace or the need to remove comments, you can address your problems using regex notation. ( https://regex101.com/ ) 2. In terms of computation, utilizing Post-order Traversal can be highly beneficial for calculations. 3. If it is indeed challenging to implement two functionalities in the same executable, consider creating separate executables for each functionality (an executable for Direct Computation Mode and another for File Mode).

交件類型為?

急件, 三天內

您的預算大約為何?

一萬以下

您希望如何與專家合作? (可複選)

透過電話或網路進行

還有什麼需要注意的地方嗎?

沒有

您需要服務的地區為何?

台北市,文山區
您可能也感興趣的案件:
台北市 文山區
UI/UX設計
梁〇為
台北市 南港區
網頁設計
黃〇安
台北市 南港區
PLC設計
Micxxx