0%

[題解]促銷活動

a147/ 促銷活動

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
using namespace std;

void discount(double &a,double &b){
if(a==b){
b = 0.5*b;
}
}
int main(){
double p1, p2;
cout << "Original price:" << endl;
cin >> p1 >> p2;
discount(p1,p2);
cout << "Price after discount:" << endl;
cout << p1 << " " << p2 << endl;
return 0;
}