文章
2
粉丝
82
获赞
0
访问
1.2k
#include<iostream>
#include<algorithm>
using namespace std;
class Water {
public:
double price;
double howmany;
double danjia;
Water() {}
void setWater(double a, double b) {
price = a;
howmany = b;
danjia = a / b;
}
};
bool com(const Water a, const Water b) {
return a.danjia < b.danjia;
}
int main() {
double summoney=0, howmany=0, money=0;
int n=0;
Water arr[1000];
//题目要求x和n为-1时结束,所以循环输入。(summoney是x,命名细节不要在意)
while (cin >> summoney >> n) {
if (summoney == -1 && n == -1)break;
for (int i = 0; i < n; i++) {
...
登录后发布评论
暂无评论,来抢沙发