programming in Microsoft visual studio.
Write a C++ program for the following algorithm. Compile, run, and
verify the result by choosing some test data.
Prompt user to write X1 value in double
Read X1
Prompt user to write X2 value in double
Read X2
Prompt user to write Y1 value in double
Read Y1
Prompt user to write Y2 value in double
Read Y2
Compute the lengths of the two sides of the right triangle
generated by the two points
Compute the distance between the two points, which is equal to the
length of the hypotenuse of the triangle.
Display the distance between the two points
Program:-
#include<iostream>
#include<math.h>
using namespace std;
int main(){
double X1, X2, Y1, Y2, len1, len2,distance;
cout<<"Enter value of X1"<<endl;
cin>>X1;
cout<<"Enter value of X2"<<endl;
cin>>X2;
cout<<"Enter value of Y1"<<endl;
cin>>Y1;
cout<<"Enter value of Y2"<<endl;
cin>>Y2;
if(X1>X2){ len1=X1-X2;
}
else{
len1=X2-X1;
}
if(Y2>Y1){
len2=Y2-Y1;
}
else{
len2=Y1-Y2;
}
distance=sqrt(len1*len1+len2*len2);
cout<<"The distance between the two points is
"<<distance;
}
You can verify this program by giving different values to points
For eg, if X1=0, X2=3, Y1=0, Y2=4
Then the distance between points (0,0) and (3,4) is 5
Output:-
Please like the answer if it is helpful to you. If any doubt,ask in comments.
programming in Microsoft visual studio. Write a C++ program for the following algorithm. Compile, run, and...
using Microsoft Visual Studio C++ write a compute program that will allow the user to: 1.Get a Factorial (using a loop) 2. perform addition and subtraction 3.allow the user to quit the program
Write a program that prompts the user to enter three points (x1, y1), (x2, y2), (x3, y3) of a triangle and displays its area. The formula for computing the distance of two points (x1, y1) and (x2, y2) is d = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); or d = Math.pow((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1), 0.5); The formula for computing the...
(C++ Microsoft Visual Studio) [15 Points] Write a while loop to calculate the average of numbers entered by the user: Ask the user to enter an integer number or -1 to stop Add the entered numbers Compute the average of the numbers outside the loop after termination Print the average
Write algorithm for a program that will prompt user to enter x and y coordinates of two points : (x1, y1) and (x2, y2) the calculate the distance between these two points. For example, if the two points are as shown below, then distance d can be evaluated using the formula below. Formula for this distance d is:Submit printout - with your name on top. Question 2 Implement the algorithm above in Java Submit printout of source code - with your name on top. Also...
Write a c# program in Microsoft visual studio to determine if the following numbers are even or not. Create an app that will read integers from an input file name Number.txt that will consist of one integer. Determine which numbers are even and which are odd. Write the even numbers to a file named Even.txt and the odd numbers to a file named Odd.txt. Number.txt 20 39 45 12 31 62 10 11 21 73 14 42 55 86 109...
The straight-line distance of two points (x1, y1) and (x2, y2) in a Cartesian plane can be calculated by the formula:Your task is to create an algorithm using flowchart to solve this problem. in your algorithm, you need to prompt user to enter the value of x1, x2. y1 and y2.
Must be done in C++ 2013 microsoft visual studio Write a program that creates a 4 x 5 two-dimensional array. The program should use loops to populate the array using the rand, srand and time functions with random numbers between 10 and 60. After the values have populated the array, output the values of the array to the screen in something that looks like a 4 x 5 table.
The questions below deal with Microsoft Visual Studio 2012
Reloaded, under the Visual Basic programming language. The book
ISBN number that I am using is: 978-1-285-08416-9 or the UPC code
is: 2-901285084168-1.
Question 1
Visual Basic 2012 is an object-oriented programming language,
which is a language that allows the programmer to use
____________________ to accomplish a program�s goal.
Question 2
An application that has a Web user interface and runs on a
server is called a(n) ____________________ application.
Question 3...
1(a) Write a python program using a function name slope(x1, y1, x2, y2) that returns the slope of the line through the points (x1, y1) and (x2, y2). 1(b) For problem 1(a), write a python program using a function name Euclidean_dist(x1, y1, x2, y2) which will calculate and return the Euclidean distance between the points (x1, y1) and (x2, y2).
C++ and Using Microsoft Visual Studio. Write 2 programs: One program will use a structure to store the following data on a company division: Division Name (East, West, North, and South) Quarter (1, 2, 3, or 4) Quarterly Sales The user should be asked for the four quarters' sales figures for the East, West, North, and South divisions. The data for each quarter for each division should be written to a file. The second program will read the data written...