-
-
Save jesyspa/4587796 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Don't forget to label as C++. | |
#include <iostream> | |
// No need to use the std namespace. | |
int main() { | |
// Arrows in the wrong direction, and forgot a newline at the end of the string. | |
std::cout << "This is used to find the slope of the line. Please enter two points.\n"; | |
// No need to use new here. | |
float y1, y2, x1, x2; | |
std::cout << "Enter Y 1:"; | |
std::cin >> y1; | |
std::cout << "Enter X 1"; | |
std::cin >> x1; | |
std::cout << "Enter Y 2"; | |
std::cin >> y2; | |
std::cout << "Enter X 2"; | |
std::cin >> x2; | |
// Split long lines. | |
std::cout << "The slope of the line that goes through the points (x1, y1) and (x2, y2) is "; | |
std::cout << (y1-y2)/(x1-x2) << '\n'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment