Hii there I have tried my best to write the program for the same .I guess this may help you out.
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
ifstream myfile;
int n;
double x[n],y[n];
myfile.open("data.txt");
cout << "Enter the no of data points to be entered (let it be less than 100) :\n";
cin >> n ;
if (myfile.is_open())
{
for ( int i = 0 ; i < n ; ++i)
{
myfile >> x[i]; // will store all the values of x from "data.txt";
myfile >> y[i]; //will store all the values of y from "dat.txt";
}
}
double xsum = 0 , x2sum =0 , ysum=0 , xysum = 0 ;
for (i=0 ; i<n ; i++)
{
xsum = xsum + x[i]; //calculate sigma x as the sum of x values
ysum = ysum +y[i]; //calculate sigma y as the sum of y values
x2sum = x2sum + pow(x[i] , 2); //calculate sum of the squares of the x values
xysum = xysum + x[i] * y[i]; //calculate the sum of the products of the corresponding x and y values
}
avg1= xsum/n; //calculate average of x values
avg2 =ysum/n; //calculate average of y values
m = ((xysum) - (xsum*avg1)) / ((x2sum) - (xsum*avg2)) ; // calculates slope m
c = (avg2 - (m.avg1)); // calculates intercept c
cout << " \n The slope of the given set of values is : \n "<< m << endl;
cout << " \n The intercept of the given set of values is : \n" << c <<endl;
}
In c++ visual studio Write a program that does the following: Reads the input data set...
Write a program using Visual Studio 2017 that accepts four (4) lines of input: • The first line contains a float value in 4.2f format • The second line contains a char value • The third line contains a 4-digit int value • The fourth line contains a char value and then displays all of the input on a single line Phone Number Write a program that accepts a phone number of the form +1(xxx)-xxxxxxx where x is a digit,...
c++ write a program that reads all values from a text file "data.txt" and stores them in ID array valuesl I. The input process from the file should be terminated when a negative value is detected. (An example of such a file is shown below). Also, the program should copy from values[ 1 any value which has even sum of digits and its index (location) to two new arrays evenArr 1 and idxArrl I, respectively. In addition, the program must...
In this assignment, you are to write a C++ program (using Visual C++ 2015) that reads training data in WEKA arff format and generates ID3 decision tree in a format similar to that of the tree generated by Weka ID3. Please note the following: Your algorithm will use the entire data set to generate the tree. You may assume that the attributes (a) are of nominal type (i.e., no numeric data), and (b) have no missing values. In general, the...
Write a function in visual basic which reads an x,y data set of unknown size and at any location on the spreadsheet calculates the slope and intercept and outputs a column which contains the y values calculated from the slope and intercept.
please answer it in a java console application form (java GUI). Least Square Lines Equation- Text File /O Suppose we have a text file (which I supplied named data.txt) that has the following table: Temperature (celsius) Resistance (ohms) 20.0 761 31.5 817 50.0 874 71.8 917 91.3 1018 Write a Java console applicatlon, that does the following: 1. Prompt the user for the name of the text file 2. Opens the text file and reads in the ordered pair data...
(statistics.py) Write a program that reads data from the file provided, data.txt, into a list. Once the data are in a list, calculate and print the following: sum = 69.28 mean = 3.46 min = 0.19 max = 8.29 You may use the Python built-ins, min(), max(), and sum(). Format the numbers using '.2f'.
CODE IN C++ 13.5 Alphabet Histogram Write a program that reads input character by character from the given data file "data.txt" The program should be case insensitive and count the number of occurances of each character in the alphabet. It should print a histogram of the results as follows: A : B : C : * D : * E : * F : G : H : I : J : * K : L : M : N...
Writing a matrix in Visual Basic Studio and not in c ++ Q3/ Write VB function/program to find the mean ( average of a 5 X 5 matrix of integers.
This C++ Programs should be written in Visual studio 2017 PROGRAM 1: Comparing Using Arrays to Using Individual Variables One of the main advantages of using arrays instead of individual variables to store values is that the program code becomes much smaller. Write two versions of a program, one using arrays to hold the input values, and one using individual variables to hold the input values. The programs should ask the user to enter 10 integer values, and then it...
1. Write a C programme by using visual Studio: a) Write a function with parameters that returen the largest of three integer arguments. So users could call your function (name: max3) to output the maximum of three input values. b) Make a function outside of the main routine. And in the main routine, please call this function and print the harmonic mean. The harmonic mean of two numbers is obtained by taking the inverses of the two numbers, averaging them,...