[問題] C++ 問題
請各位高手幫我看一下為什麼跑不出來!!!謝
Write a function with the following prototype:
bool compute(int one, int two, int & sum, int & product, double & quotient);
sum will be one + two, product will be one * two, and
quotient will be one/two provided that two is not 0.
If the quotient can be computed,( i.e. two is not 0 ) return true.
If the quotient cannot be computed ( i.e. two has a value of 0 ), return false.
Write a driver program to test both cases.
#include <iostream>
using namespace std;
bool compute(int one, int two, int& sum, int& product, double& quotient);
int main()
{
int a,b,c,d,e;
cout << "please enter two number: ";
cin >> a >> b;
compute(a,b,c,d,e);
cout << "Results: "
<< c << ' '
<< d << ' '
<< e << endl;
return 0;
}
bool compute(int one, int two, int& sum, int& product, double& quotient)
{
sum = one + two;
product = one * two;
quotient = one/two;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 71.199.79.106
推
02/27 01:50, , 1F
02/27 01:50, 1F
→
02/27 01:53, , 2F
02/27 01:53, 2F
推
02/27 02:13, , 3F
02/27 02:13, 3F
推
02/27 09:56, , 4F
02/27 09:56, 4F
→
02/27 09:56, , 5F
02/27 09:56, 5F
→
02/27 09:57, , 6F
02/27 09:57, 6F
→
02/27 09:57, , 7F
02/27 09:57, 7F
→
02/27 09:58, , 8F
02/27 09:58, 8F
→
02/27 09:58, , 9F
02/27 09:58, 9F
→
02/27 09:58, , 10F
02/27 09:58, 10F
→
02/27 09:59, , 11F
02/27 09:59, 11F
→
02/27 09:59, , 12F
02/27 09:59, 12F
推
02/27 10:02, , 13F
02/27 10:02, 13F
→
02/27 11:29, , 14F
02/27 11:29, 14F
推
02/27 16:15, , 15F
02/27 16:15, 15F
→
02/27 16:16, , 16F
02/27 16:16, 16F
推
02/27 17:14, , 17F
02/27 17:14, 17F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章
74
180