首页 > > 详细

C辅导 Exercise 1辅导C/C++设计


Introduction


=(/17()-)
= 10 0 7575
=(-)1.2
=+*1.055
Exercise 1
A user enters a series of n positive integers (n is also entered). Build a program to:
· display the number of missing integers in the series,
· display the missing integers in the series.
Example
If the user enters 3 5 7 13, the program will display exactly:
There are 7 missing numbers
The missing numbers are: 4, 6, 8, 9, 10, 11 and 12.
Exercise 2
There are numbers in mathematics that have strange properties. For example, some numbers n respect the following property:
n = 1 + k (sum of divisors (n) - n -1)
For example, 21 = 1 + 2 ((1 + 3 + 7 + 21) 1)
The use of tables and / or functions is prohibited in this PROJECT.
Build a program to:
a) checking whether any number n satisfies this property (enter the number and the value of k),
b) display the list of all numbers verifying this property, between 1 and a max input terminal (k will also be entered).
Exercise 3
We assume in this exercise that we work on unsigned integers coded on two bytes. Build a program to:
· to enter such an integer,
· to set to 0 or to 1 bits 5 to 12 the constituent,
· display the result in base 10 and base 2.
For example, for n = 32742, we obtain the binary decomposition:
0111 11111110 0110
Setting the central part to zero would result in:
0111 00000000 0110
The decimal result would therefore be: 28678.
Note: Use of binary manipulation operators is prohibited.
exercise 4
Villedieu’s activity is the rental of vehicles with chauffeur. It proposes to make available to its customers a motor vehicle with driver.
The company manager needs a program to calculate the invoice of any client.
The following elements provide the rules used to construct the necessary formulas:
1 the driver’s hours of work are billed on the basis of three time slots (from 9
hours at 6 pm, from 6 pm to 11 pm, from 6 am to 9 am),
2 the driver’s meals are charged,
3 Each rented vehicle has a code constructed as follows: 5 characters for
its identification, 1 character giving a reduction rate, 3 characters giving the rental price of the vehicle by the day; for example, with 123454150
o the identification number is: 12345,
o the reduction rate applied to the rental of the vehicle is 4%.
minimum reduction to be applied is 10.00 euros, maximum 75.00 euros and this
regardless of the rate of reduction provided that it is non-zero) o The daily rental price is 150 euros
· a 5.5% VAT applies to the driver’s meals,
· a 20% VAT applies to the driver’s working hours, as well as to the rental of the
vehicle.
Finally, on weekends, the working hours are double.
Build a complete C program to calculate the total invoice of any client.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!