Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
909 B
3
Indexable
Never
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    float x1, x2, y1, y2, a, b;
    
    printf("Wspolrzedne punktu P1:\n");
    printf("x1: ");
    scanf("%f", &x1);
    printf("y1: ");
    scanf("%f", &y1);
    
    printf("\nWspolrzedne punktu P2:\n");
    printf("x2: ");
    scanf("%f", &x2);
    printf("y2: ");
    scanf("%f", &y2);
    
    printf("----------------------------\n");
    
    a = (y1 - y2)/(x1 - x2);
    b = y1 - a*x1;
    
    printf("Wspolczynnik a: %f\n", a);
    printf("Wspolczynnik b: %f", b);
    return 0;
}