Write a c++ program to load two column of numbers, do arithmetic operations to the data points by following the steps below carefully. Output the computed results to the specified output files
Steps to complete.
0. Download the data file named Datafile1.data from the file area of the assignment.
1. Load two columns of data points, each column into a storage area, preferably a vector.
2. Add each position of the data and store it in another storage area.
3. Multiply each position of the data and store it to another storage area.
4. Write the results of addition and multiplication to file named Output-Multiplication.data and Output-Addition.data
Datafile1.data
9.144548371 0.62072663
7.766500067 1.107554175
6.428523445 0.409904615
4.864271967 1.142139412
7.064106885 1.138740729
2.262955152 1.198965847
9.800966285 0.624420569
8.466914743 0.172152387
7.089199692 0.650149663
6.042680886 0.526675179
1.320701358 0.893658642
3.576178301 0.966546628
4.939756105 0.53583099
3.386905283 0.24428521
5.231554752 0.660683916
3.736280728 0.378121052
7.527971435 0.917047269
2.533630929 1.029850114
9.188222671 0.237647807
1.800088589 0.763132902
9.702171329 1.187835787
4.713240732 0.602808579
0.350114291 0.126105779
1.375572924 0.534626533
3.699384174 0.670885379
7.183110563 1.327536861
7.434890545 1.174302317
9.781202522 1.271484048
7.153021655 0.99647769
0.516259776 0.868291689
9.637573135 0.596947716
7.056519481 0.350322259
0.160533268 0.565683307
9.008315924 0.919842547
9.173718748 0.593500412
6.921833783 0.015908284
6.736418485 0.719292318
3.353631576 1.363438995
1.604967361 0.679785674
5.672035588 0.171718917
7.794867595 0.550310846
5.889160186 0.07760882
1.690701207 0.829202546
4.155650455 0.94739278
6.018503489 0.989127529
1.46468541 1.171169011
2.670443291 0.505688273
8.22853784 0.514127061
9.631840542 0.238298413
1.669453846 1.27499486
3.311515543 0.789657118
5.969493897 0.053853209
2.478574394 1.206080543
7.696244495 0.099599082
3.769765061 1.193693451
1.992200015 0.895544331
4.030882115 0.398607671
2.939993773 0.360149058
8.499182913 0.645159168
1.33467738 0.264472403
3.475730127 0.826362657
7.471431245 1.220818624
6.140279634 0.462733534
3.740656241 1.363952935
5.174154405 1.157155608
9.466008548 0.261690906
9.225005657 0.158991829
7.061522707 0.200296564
2.527050453 0.668705617
3.989058951 0.659984653
5.969333965 0.297768248
6.813173789 1.23032852
7.47467435 0.289477322
0.27004337 0.808100642
0.226724804 0.947863653
8.491775489 0.703714179
9.67169797 0.439579426
7.171630039 0.893035833
8.435125276 0.053497387
1.740878827 1.135864744
1.624571489 0.537973501
9.398492585 1.285333242
9.855769556 1.156707773
5.536670988 0.524629176
COMPUTER SCIENCE... PLEASE HELP!!
#include <iostream>
#include <vector>
#include <fstream>
#include <iomanip>
using namespace std;
int main()
{
vector<double> column1;
vector<double> column2;
ifstream fin("Datafile1.data.txt");
//Each position of colum1 and column2 is separated by
7 spaces
//So, first we initialise both vectors
//Take input in column1 then ignore 7 spaces then
input in column2
//Keep doing this until files end
if (fin.is_open())
{
double temp = 0; //temporary
variable to hold value
while (!fin.eof())
{
fin >>
temp;
column1.push_back(temp);
//ignore 7
spaces
fin.ignore();
fin.ignore();
fin.ignore();
fin.ignore();
fin.ignore();
fin.ignore();
fin.ignore();
fin >>
temp;
column2.push_back(temp);
}
}
else
{
cout << "File failed to open
" << endl;
}
/*cout << "Both Columns: " << endl
<< endl;
for (int i = 0; i < column1.size(); i++)
{
cout << setprecision(9)
<< column1.at(i) << " " <<
column2.at(i) << endl;
}*/
vector<double> Addition_column;
for (int i = 0; i < column1.size(); i++)
{
Addition_column.push_back(column1.at(i) + column2.at(i));
}
ofstream fout1("Output-Addition.data.txt");
for (int i = 0; i < Addition_column.size();
i++)
{
fout1 << setprecision(9)
<< Addition_column.at(i) << endl;
}
/*cout << "Output - Addition " << endl
<< endl;
for (int i = 0; i < Addition_column.size();
i++)
{
cout << setprecision(9)
<< Addition_column.at(i) << endl;
}*/
vector<long double> Multiplication_vector;
//this is long double because during multiplication decimal places
may exceed limit of double
for (int i = 0; i < column1.size(); i++)
{
Multiplication_vector.push_back(column1.at(i) *
column2.at(i));
}
ofstream
fout2("Output-Multiplication.data.txt");
for (int i = 0; i < Addition_column.size();
i++)
{
fout2 << setprecision(18)
<< Multiplication_vector.at(i) << endl;
}
/*cout << "Output - Multiplication " <<
endl << endl;
for (int i = 0; i < Multiplication_vector.size();
i++)
{
cout << setprecision(18)
<< Multiplication_vector.at(i) << endl;
}*/
system("pause");
}
Data File:
9.144548371 0.62072663
7.766500067 1.107554175
6.428523445 0.409904615
4.864271967 1.142139412
7.064106885 1.138740729
2.262955152 1.198965847
9.800966285 0.624420569
8.466914743 0.172152387
7.089199692 0.650149663
6.042680886 0.526675179
1.320701358 0.893658642
3.576178301 0.966546628
4.939756105 0.53583099
3.386905283 0.24428521
5.231554752 0.660683916
3.736280728 0.378121052
7.527971435 0.917047269
2.533630929 1.029850114
9.188222671 0.237647807
1.800088589 0.763132902
9.702171329 1.187835787
4.713240732 0.602808579
0.350114291 0.126105779
1.375572924 0.534626533
3.699384174 0.670885379
7.183110563 1.327536861
7.434890545 1.174302317
9.781202522 1.271484048
7.153021655 0.99647769
0.516259776 0.868291689
9.637573135 0.596947716
7.056519481 0.350322259
0.160533268 0.565683307
9.008315924 0.919842547
9.173718748 0.593500412
6.921833783 0.015908284
6.736418485 0.719292318
3.353631576 1.363438995
1.604967361 0.679785674
5.672035588 0.171718917
7.794867595 0.550310846
5.889160186 0.07760882
1.690701207 0.829202546
4.155650455 0.94739278
6.018503489 0.989127529
1.46468541 1.171169011
2.670443291 0.505688273
8.22853784 0.514127061
9.631840542 0.238298413
1.669453846 1.27499486
3.311515543 0.789657118
5.969493897 0.053853209
2.478574394 1.206080543
7.696244495 0.099599082
3.769765061 1.193693451
1.992200015 0.895544331
4.030882115 0.398607671
2.939993773 0.360149058
8.499182913 0.645159168
1.33467738 0.264472403
3.475730127 0.826362657
7.471431245 1.220818624
6.140279634 0.462733534
3.740656241 1.363952935
5.174154405 1.157155608
9.466008548 0.261690906
9.225005657 0.158991829
7.061522707 0.200296564
2.527050453 0.668705617
3.989058951 0.659984653
5.969333965 0.297768248
6.813173789 1.23032852
7.47467435 0.289477322
0.27004337 0.808100642
0.226724804 0.947863653
8.491775489 0.703714179
9.67169797 0.439579426
7.171630039 0.893035833
8.435125276 0.053497387
1.740878827 1.135864744
1.624571489 0.537973501
9.398492585 1.285333242
9.855769556 1.156707773
5.536670988 0.524629176
OUTPUT ADDITION:
9.765275
8.87405424
6.83842806
6.00641138
8.20284761
3.461921
10.4253869
8.63906713
7.73934935
6.56935607
2.21436
4.54272493
5.47558709
3.63119049
5.89223867
4.11440178
8.4450187
3.56348104
9.42587048
2.56322149
10.8900071
5.31604931
0.47622007
1.91019946
4.37026955
8.51064742
8.60919286
11.0526866
8.14949935
1.38455146
10.2345209
7.40684174
0.726216575
9.92815847
9.76721916
6.93774207
7.4557108
4.71707057
2.28475304
5.8437545
8.34517844
5.96676901
2.51990375
5.10304324
7.00763102
2.63585442
3.17613156
8.7426649
9.87013896
2.94444871
4.10117266
6.02334711
3.68465494
7.79584358
4.96345851
2.88774435
4.42948979
3.30014283
9.14434208
1.59914978
4.30209278
8.69224987
6.60301317
5.10460918
6.33131001
9.72769945
9.38399749
7.26181927
3.19575607
4.6490436
6.26710221
8.04350231
7.76415167
1.07814401
1.17458846
9.19548967
10.1112774
8.06466587
8.48862266
2.87674357
2.16254499
10.6838258
11.0124773
6.06130016
OUTPUT MULTIPLICATION:
5.67626469320281934
8.60181957434362943
2.63508142774119891
5.55567672419746295
8.04418622395881933
2.71320594054069364
6.11992494442951607
1.45759958353294139
4.60904079069350381
3.18253003727392914
1.18025618207783589
3.45654307795831928
2.64687440410069375
0.827370868307764407
3.45640408031976865
1.41276639943868587
6.90350564557676183
2.60926010106457618
2.18356096799083232
1.37370682878065509
11.5245863161915523
2.84118194814183944
0.0441514354055876912
0.735417783246792522
2.48186275364059172
9.53584404902096239
8.73080919363489194
12.4366429769803677
7.12782649529437684
0.44826407286580161
5.75312727072120911
2.47205584526142763
0.090810989925757285
8.28623226371281874
5.44460585651012519
0.110114497620758395
4.84545406709369875
4.5724720655817066
1.09103381924538634
0.973995808356818205
4.28960018066243531
0.457050772826440466
1.40193374536967297
3.93703323727071508
5.9530674843524487
1.71539416305582937
1.3504118559702265
4.23051397600648826
2.29525231542766006
2.1285450726572317
2.61496181989758547
0.321476402459365485
2.9893603509814155
0.7665388865495536
4.49994386512431532
1.78410342965136492
1.60674053193570399
1.05883598787181588
5.48332577683089628
0.352985333918344191
2.87221358276266736
9.12126241183150732
2.84131329478904648
5.10207905873801693
5.98730178640365374
2.47716835312986428
1.4667005219417768
1.41439873482007883
1.68985283236349448
2.63271768757227909
1.77747811648494336
8.38244202432316321
2.16374871366009058
0.218222220664843536
0.214904200945149004
5.97578281649395837
4.25147944209796513
6.40452260584618749
0.45125716128365384
1.97740288316537538
0.87397641156211292
12.0801949441910104
11.400245254321959
2.90469913821754622



COMMENT DOWN FOR ANY QUERIES AND,
LEAVE A THUMBS UP IF THIS ANSWER HELPS YOU.
Write a c++ program to load two column of numbers, do arithmetic operations to the data...
Program in C++! Thank you in advance! Write a menu based program implementing the following functions: (1) Write a function that prompts the user for the name of a file to output as a text file that will hold a two dimensional array of the long double data type. Have the user specify the number of rows and the number of columns for the two dimensional array. Have the user enter the values for each row and column element in...
c++
Program 5: The load, Per, in units of kips, applied to a column that causes the column to buckle is referred to as the critical buckling load. This load can be determined by using this formula: double LOREAKNE cload (did, did} ③ resulta cloadf. do ushe E is the modulus of elasticity of the column's material A is the cross-sectional area. Lis the length of the column. is the column's radius of gyration. Using this formula, write a C++...
Write c program. Do part 4 and 5
CH-12 TEXT FILES SE 12-3 Create a text file named grade.txt that you type yourself by your Each record in grade.txt should have the following format: by Columns 1-4 6-8 number of a student A grade out of 100 EYERCISE 12-4 Write a program that will read the identification numbers of students and their letter grades (A, B, C, D, or F) from the keyboard and store them in a text file...
Using C# or Python, write a code that reads a Microsoft Excel CSV file named "LabAssignment" then outputs all the collected and formated data as another Microsoft Excel CSV file named "labOutput" The CSV file contains 25 colums as well close to 200 rows of data. Write a code in C# or Python so that: It removes all unwanted columns along with its data...the columns that should be kept have the following header: "User" "Location" "Feature" "HoursUsed" Remove all files...
Write a c++ program to implement bubble sort of the data point given in the file data_points.txt file found in the Files area under assignments. Submit the source code in canvas. Do not change the data file name in your program if you are using file operations to load the values and should read from the same directory where your program reside
OUTCOMES After you finish this assignment, you will be able to do the following: Define an abstract class Create concrete classes from an abstract class Overload an operator Split classes into .h and .cpp files Open files for reading Write to files Use output manipulators such as setw, fixed, and setprecision DESCRIPTION A binary arithmetic operation takes two double operands (left and right) to perform addition, subtraction, multiplication, or division on. For example, 10 + 11 is an addition (+)...
Write a menu based program implementing the following functions: (0) Write a function called displayMenu that does not take any parameters, but returns an integer representing your user's menu choice. Your program's main function should only comprise of the following: a do/while loop with the displayMenu function call inside the loop body switch/case, or if/else if/ ... for handling the calls of the functions based on the menu choice selected in displayMenu. the do/while loop should always continue as long...
The answer need to write in C programming.
QUESTION 2 Write a program using array to generate a multiplication table based on the user's input. For example if user enter 5 as input then a multiply table for 1 to 5 is printed as output as shown in Figure Q2. There are three main steps in this program which are: Print rows (a) (b) Print columns Print multiplication of data inside table (c) Select C:\example1 \bin\Debuglexample 1.exe enter the value...
Create a program (Lab9_Act1_Write.py) that will read in data from the keyboard and store it in a file. Your program should prompt the user for the name of the file to use and then request values be entered until the user is done. This data should be written to two files: a text file, user_file_name.txt and a comma separated value file, user_file_name.csv. To help you with decision making, we suggest that you ask the user to input data representing students’...
Write a C++ program to define a class having a 4x4 matrix. Generate 32 random numbers 1-10, in an output.txt file. Fill the generated numbers in two such class objects (first 16 numbers in one matrix and next 16 numbers in another. Create member functions each for adding, subtracting and multiplication of matrices. Write the algorithm defining steps of your program.