C++ 2nd Experiment (Basic Class) - Simple Programming

[Item 1]
The standard weight formula for adult males with standard weight is: standard weight (kg)=height (cm)−100; 20% over the standard weight is overweight, and 20% lighter than the standard weight is overweight. Please write a C++ program, input the height and weight, and complete the following tasks: 
calculate the standard weight, output the weight status (normal/overweight/ultra-light, and give prompts accordingly).  After debugging the program, please publish a blog post as a report on the computer.  


[Item 2] Piecewise function evaluation

Program, calculate the value of the following function and output (x can be an integer)



【Item 3】Distance between two points

Input the coordinates of two points, find the distance between the two points and output
(1) The coordinates of the two points are represented by 4 variables x1, y1, x2, y2, after inputting the coordinate values, calculate the distance between the two points;
(2) The square root of the distance is required, and the square root needs to be implemented by calling the function sqrt(). For example, use sqrt(x) to find the square root of x. It should be noted that to call the sqrt() function, you must write: #include<cmath> at the beginning of the program.


[Item 4] Simulate ATM
screen output: XX Bank welcomes you (for example, Zeng's Bank welcomes you)
Please input password: User input password (on a real ATM, the entered password is displayed as *, which is not visible to others. I will not deal with it first. Temporarily use an integer as the password. Of course, on a real ATM, you need to check whether the password is correct!)

Display function options
1. Inquiry
2. Withdrawal
3. Deposit
4. Transfer
0. Exit
User input function selection
Display: Thank you, you have selected the x number function (the current program, when the input is not 0-4, can be accepted, and I will talk about it later)
program ends

Extension: After entering the password, determine whether the password is correct, the correct password will use the date of birth

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325650387&siteId=291194637