7.1
来源:互联网 发布:java打印word文档 编辑:程序博客网 时间:2024/05/22 23:28
#include<iostream>
#include<string>
using namespace std;
struct Sales_date
{
string bookNo;
unsigned units_sold = 0;
double revenue = 0.0;
};
int main()
{
Sales_date total;
if (cin >> total.bookNo>>total.units_sold>>total.revenue)
{
Sales_date trans;
while (cin >> trans.bookNo >> trans.units_sold >> trans.revenue)
{
if (total.bookNo == trans.bookNo)
{
total.units_sold += trans.units_sold;
total.revenue += trans.revenue;
}
else
{
cout << total.bookNo << "------" << total.units_sold << " -----" << total.revenue << endl;
total = trans;
}
}
cout << total.bookNo << "----" << total.units_sold << "------ " << total.revenue << endl;
}
else
{
cerr << "No date" << endl;
return -1;
}
}
#include<string>
using namespace std;
struct Sales_date
{
string bookNo;
unsigned units_sold = 0;
double revenue = 0.0;
};
int main()
{
Sales_date total;
if (cin >> total.bookNo>>total.units_sold>>total.revenue)
{
Sales_date trans;
while (cin >> trans.bookNo >> trans.units_sold >> trans.revenue)
{
if (total.bookNo == trans.bookNo)
{
total.units_sold += trans.units_sold;
total.revenue += trans.revenue;
}
else
{
cout << total.bookNo << "------" << total.units_sold << " -----" << total.revenue << endl;
total = trans;
}
}
cout << total.bookNo << "----" << total.units_sold << "------ " << total.revenue << endl;
}
else
{
cerr << "No date" << endl;
return -1;
}
}
0 0
- 7.1
- 7.1
- 7.1
- 7.1
- 7.1
- 7.1
- 7.1
- 7.1
- 7.1
- 7.1
- 7.1
- 7.1
- 7.1
- 7.1
- 7.1
- 7.1
- 7.1
- 7.1
- [JPA错误]javax.persistence.EntityNotFoundException: Unable to find xxx
- 字符串回文子序列问题
- cjson不连续存储问题
- UML——类图,对象图,包图
- Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'问题的解决
- 7.1
- IOS开发 - KVC和KVO的使用
- 嵌入式 多线程下变量-原子操作__sync_fetch_and_add等等
- 2015 11 04 函数指针
- spring的四种注入方式
- 【LeetCode OJ 003】Longest Substring Without Repeating Characters
- hihocoder 1110 正则表达式
- poj1163 dp the triangle
- 删数字nyoj448