To say I'm a beginner is being generous. I'm working on a project for a beginning C++ Programming for Engineers class. I almost have the complete code accept for one thing. I need the output on the screen to print to a data file called "data" at the same time.
All of my searches so far have led me to code for entering data into the table using scanf and/or fscanf. I don't need to input any data, I just need to take the table I already have and output it to a data file.
I don't know if I'm stating this correctly, but I will include my code so far and hopefully somebody can give me some helpful advice. I would like to include the output from running the program, but I CAN'T PRINT IT TO A FILE that I can copy and paste from!!! Sorry. I'm just a little frustrated.
Thanks!
#include <stdio.h>
#include <math.h>
#define M 10
double asolve(int n, double xi[], double yi[]);
double bsolve(int n, double xi[], double yi[]);
/* You'll need to*/ #include <fstream>
ofstream filestreamObject ( "myfile.txt" ); // filestreamObject can be ANY name you choose
filestreamObject >> // Insert ints to write, newlines, spaces, etc here
For example, I want to write a file called "numbers.txt" that looks like this: