I'm new in programming and I've switched from Windows to Mac but I have a problem in programming, I have to do my homework for school in c++ using input and output files
. Can I do it with Xcode?
I'm new in programming and I've switched from Windows to Mac but I have a problem in programming, I have to do my homework for school in c++ using input and output files. Can I do it with Xcode?
Of course you can. Just choose the c++ template in Xcode.
Edit: Pick application in the left pane of your "New Project" window, then pick "Comman Line Tool" and lastly, change the type to C++ stdc++.
I already did that but I don't know where I can put my input and output files I tried New File/C++ Header File but I don't know why it doesn't work.
You will need to provide a file path to the files when you opening them for reading. But, honestly with only one source file it's probably less confusing to just use the command line and the g++ compiler.
Heh, I would like to be able to do that but the only way to work for school and verify my programs is to send them at school's online evaluator but for that I have to use the fstream library, on MinGW(Windows) I was just
#include <fstream.h>
ifstream fin("NAME.in");
ofstream fout("NAME.out");
And then add 2 header files NAME.in and NAME.out, I tried the same on Xcode but it's not working.
But as I said, you can use the terminal instead and compile manually.
Look inside your project folder, you will find an executable file in there (with a black exec icon) put your files there.
You mean at Products? I also tried there but still my output file is empty.
Especially since the OP is using MinGW on Windows and not an IDE like Visual Studio.