Hi all am actually new to C++ and programming in general and I need ur help. Am trying to find the slope(m) and intercept(b) of the linear equation of the form y = mx + b but i dont know why the code is not working. Kindly help me take a look at :
#include <cstdlib>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <iomanip>
using namespace std;
{
double z=0;
double p=0;
long double m;
long double b;
double x[100], y[100];
int n;
std::cout <<"what is n where n is the number of x\n";
std::cin >> n;
std::cout << "supply the values of x\n";
for ( int i = 0; i < n; i++)
{
std::cin >>x[i];
}
std::cout << "supply the values of y\n";
for (int i = 0; i < n; i++)
{
std::cin >>y[i];
}
for (int i=0; i < n; i++)
{
cout<<"x"<<i<<" = "<<x[i]<<"\n";
}
for (int i= 0 ; i < n; i++)
{
cout<<"y"<<i<<" = "<<y[i]<<"\n";
}