using namespace std;
int a[5],n,test;
string ppl[6][6]={{"1","2","3","4","5"},{"1","2","3","4","5"},{"1","2","3","4","5"},{"1","2","3","4","5"},{"1","2","3","4","5"}};
int main() {
cin>>n;
freopen ("duty.txt","r",stdin);
for (int i=0;i<5;i++) cin>>a[i];
fclose(stdin);
if (n==0){
freopen ("duty.txt","w",stdout);
for (int i=0;i<5;i++){
if (a[i]==5) cout<<1<<endl;
else cout<<a[i]+1<<endl;
}
fclose(stdout);
}
else if (n<=5&&n>0){
cout<<"Group "<<n<<": "<<endl;
for (int j=0;j<5;j++) cout<<"No."<<j+1<<": "<<ppl[n-1][j]<<endl;
}
else
for (int i=0;i<5;i++){
cout<<"Group: "<<i+1<<" ";
for (int j=0;j<5;i++)
cout<<ppl[i][j]<<" ";
cout<<endl;
}
return 0;
}```
#How to convert this simple program into a windows application
1 messages · Page 1 of 1 (latest)
@ivory thistle
It looks like you may have code formatting errors in your message
Note: Make sure to use back-ticks (`) and not quotes (')
Note: Make sure to specify a highlighting language, e.g. `cpp`, after the back-ticks
Markup
```cpp
int main() {}
```
Result
int main() {}
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
Don't include bits/stdc++, that's for internal use by the compiler
Wdym by windows application? To make it compile and run on Windows?
to change it into a windows app
What does that mean? A GUI?
like change it into a runnable app for every windows users
it can't be compiled for those who don't have a c++ compiler
So I want it to convert to an application, so that all windows users can run
wdym
When you compile code it makes an executable that you run
oh
And that runs your program
how about mac users?
Same thing but you'll likely need a different compiler, and executables on Macs are different
You can't run a Windows program on a Mac and vice versa
You need to compile the code with a compiler capable of producing an executable Mac can run
So Clang most likely
Are you on Windows?
I am on windows
I did another simpler code which output just 1
@ivory thistle Please do not send executable files
Idk if you can compile an executable for Mac from Windows tbh, it sounds like it'd be annoying to do
it shows a terminal and closed it instantly
It closed cause the program finished
that a bit too fast
I didn't even see the output
ha
You can pause at the end or run in a command prompt so you can still see the output after it finishes
Are you using Visual Studio?
Is this an IDE?
Why do you want it to work on mac? Does your teacher requires it to?
system(“pause”)
my teachers computer is mac
:/
And he requires you to submit something that can work on his pc? That's unreasonable
You sure you didn't misunderstand him?
Maybe he just wants the .cpp file? A mac executable sounds weird
There's a tool called Wine that can run Windows programs on other OSes, including on Mac. If they use it, they'll be able to run it as is
he says it just a fun challenge, and he will give us an additional mark if we can give him a sort of application that works on his computer
is that like a converter?
nobody knows:)
No, it doesn't produce a new executable. It runs the existing one
That's how folks on linux play windows games, for example
Look up cross-compilation. This means compiling for a different OS compared to the one you're using
There are tools to cross-compile to mac
Alright
but how can I create like a mac application?
it block sending exe files?
cross compilation?
didn't he say it a tool to compile?
@midnight mauve Please do not send executable files
compiling for Mac OS from Windows, that sounds like cross compilation
this?
or use zig c++
what is zig c++
there's a programming language called zig, it ships with its own C++ compiler. it supports cross compilation
So I have to learn a whole new language??
No, as I said. Wine runs windows executables on mac, it doesn't create the actual mac executables. That's likely not what they want.
There are tools to produce mac executables without having a mac, this process is called cross-compilation
zig xD
no
i meant zig c++, not zig
ohhhh
zig c++ <your_file>.cpp -target x86_64-macos
terminal?
or i think it's aarch64-macos-gnu instead
I am confused for that command xd
either of them
where do I enter that
Maybe I will try it tmrw, I have class on Thursday, hopefully I can do it
btw, 5 more message then this chat would reach 100
you'll also need MacOS SDK
Meh
Cross-compilation can be interesting, but copying commands we give you without understanding, just to get marks? I dunno
where do i even enter those command
it is a bonus, teacher encourage us to do some research online
See? 
are you doing research?
did research on the freopen
That's something else entirely
now i just need to make it an app
Because you didn't know how the process is called ("cross-compilation")
Try googling cross-compile c++ from windows to mac
I will close this for now I guess
Quick googling points to this: https://stackoverflow.com/a/19891283/2752075
This is what I would use