Howdy!
I've programmed in C++ on Windows for nearly 2 years. I recently switched to a Mac, and started using Xcode.
Then I come across a little snag, when I started writing a simple test program to spit me a numerical values on a txt/dat file.
#include <iostream>
#include <fstream>
using namespace std;
int main (int argc, char * const argv[]) {
fstream fout("test.dat", ios:
ut);
double a = 1;
double b = 0;
fout << "Hello World!\n" << endl;
fout << a << '\t' << b << '\t' << a+b << '\t' << a-b << endl;
}
The program successfully complied, as it should. When I opened test.dat, I do get the line "Hello World!"; however, the numerical values of a, b, a+b, and a-b does not appear. Any suggestions? Thank you.
Cheers,
Charles
I've programmed in C++ on Windows for nearly 2 years. I recently switched to a Mac, and started using Xcode.
Then I come across a little snag, when I started writing a simple test program to spit me a numerical values on a txt/dat file.
#include <iostream>
#include <fstream>
using namespace std;
int main (int argc, char * const argv[]) {
fstream fout("test.dat", ios:
double a = 1;
double b = 0;
fout << "Hello World!\n" << endl;
fout << a << '\t' << b << '\t' << a+b << '\t' << a-b << endl;
}
The program successfully complied, as it should. When I opened test.dat, I do get the line "Hello World!"; however, the numerical values of a, b, a+b, and a-b does not appear. Any suggestions? Thank you.
Cheers,
Charles