- 分享
- 0
- 人气
- 0
- 主题
- 11
- 帖子
- 267
- UID
- 158379
- 积分
- 249
- 阅读权限
- 14
- 注册时间
- 2008-8-3
- 最后登录
- 2019-6-2
- 在线时间
- 283 小时
|
今天是第一次写C++program,算是学校功课~我不知道要怎样?请教下~
这是题目
The loan entitlement for students in the library is up 3 book and they must be returned within a maximum loan period of 14 days. Fines are imposed on verdue items at the rate of RM0.20 per book per day. create a program to calculate the fine.Your program should:
-define constants for the maximum load period and fine rate
-read the number book and the number of day borrowed(you may assume that the input is always less than 3 book and greater than 14 days)
-calculate and display number of the days overs and total fine imposed
红色:那边要怎样写?我卡在process那边~T^T
我写到这样
#include <stdio.h>
void main()
{
// variable
int number_book, loan_period, days_overdue;
double fine, fine_rate;
printf("~~~~~~~~~~~~~~~~~\n");
printf("BOOK LOAN SYSTEM\n");
printf("~~~~~~~~~~~~~~~~~\n");
//inout
printf("Enter the number of books : ");
scanf("%d", &number_book);
printf("Enter the day of the loan :");
scanf("%d", &loan_period);
//process
number_book < 3;
loan_period > 14;
fine_rate = 0.20;
fine = loan_period > 14 * fine_rate;
//output
printf("~~~~~~~~~~~~~~~~~\n");
printf("\n %s, ", days_overdue);
printf("fine_rate %f.", fine);
} |
|