请问具体怎么生成一个process, 然后这个process负责display 目录 (console 目录
就行了) 然后在这个process里创建3-4个threads ,每个thread 都负责去做一些
简单的公式计算呢呢?或者说,我怎么在process里用这些threads? 一下从data
structure的颗跳到system..有点摸不着边。。什么api 的都不懂。。。眼看作业今天
就要due 了。。
Write a program in C++ for a server (called math solver) which solves three
math problems: factorial (i.e. n!), exponent with base 2 (i.e. 2n), and cube
(i.e. n3). The server should be implemented as a process and the three
problems are implemented in three threads.
The server process is responsible for posting a menu of choices for the
user to select. Once a choice is made, the server asks the user for a
nonnegative integer (including 0). The server then creates the corresponding
thread and passes the integer to it to solve the problem. The program
continues until the user stops it.
The following shows a scenario of running the program, where user’s
inputs are represented in boldface.
>p2smith {an executable program}
program starts running .....
which problem do you like to solve?
1 = factorial
2 = exponent with base 2
3 = cube
4 = exit
2 please enter a nonnegative integer: 5 the answer is: 32 {from the exponent thread}
which problem do you like to solve?
1 = factorial
2 = exponent with base 2
3 = cube
4 = exit
3 please enter a nonnegative integer: 4 the answer is: 64 {from the cube thread}
which problem do you like to solve?
1 = factorial
2 = exponent with base 2
3 = cube
4 = exit
4