[SOLVED] 代写 C++ C++ Assignment 1

30 $

File Name: 代写_C++_C++_Assignment_1.zip
File Size: 254.34 KB

SKU: 0634373449 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


C++ Assignment 1

You should submit two cpp files, “Q1_your_student_id.cpp” and “Q2_your_student_id.cpp” to iSpace.

Q1

Consider any two points (x1, y1) and (x2, y2) on a 2-D coordinate plane, we can calculate the distance between these 2 points and the angle that the line makes with x-axis using the equations below:

•Distance:
•Angle:

In this question, which equation you should use depends on whether the last digit of your student ID number is odd or even, according to the table below:
If the last digit of your student ID number is
You should calculate
Odd
Distance
Even
Angle

1.1 Use the messages below to prompt for the user’s input of the coordinates of two points.
The user inputs the x- and y-coordinate of a point in the same line separated by a space (You can assume that the users always enter numbers as the input for all the coordinates. ):
Input (x1, y1): 3.2 1.5
Input (x2, y2): 17.5 14.2
1.2According to the equation you use in this question, the program calculates the distance or angle, and the result using the following output messages with 3 decimal accuracy.
The distance is 19.125 units
or
The angle is 0.726 radians
Q2

In this question, a positive integer value is considered. By checking every 2 consecutive digits form the value, you are going to find the largest or smallest 2-digit value according to the table below:

If the second last digit of your student ID number is
You should calculate
Odd
Largest 2-digit value
Even
Smallest 2-digit value

2.1 Use the messages below to prompt for the user’s input of any positive integer value with
2 to 9 digits (You can assume that the users always enter integers when being asked for input, and the first digit of the input number is a non-zero value):
Input a positive integer with 2 to 9 digits: 462056843

•Following 2.1 above, if the user inputs an invalid value, the following error message
should be displayed, and the program should allow user to input again until a correct
value is received:

Error: Out-of-range. Input again: 4
Error: Out-of-range. Input again: 1462056843
Error: Out-of-range. Input again: -46205
Error: Out-of-range. Input again: 462056843

2.3 According to the value you find in this question, the program displays the 2-digit result
using the following output messages (e.g. input value as shown in 2.1):
The largest 2-digit value is 84
or
The smallest 2-digit value is 05

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 C++ C++ Assignment 1
30 $