for magic what ?!
2007-01-23 09:40:19
·
answer #1
·
answered by Luay14 6
·
0⤊
0⤋
You use the argc value to get the count and the argv[] array to get the values. If you are not familiar with arrays, this won't make sense to you so browse that section of your textbook first then do the problem. Remember that argv[] values are char* so if you don't know about pointers, read up on that as well.
Note: You won't master pointers in 1 hour so don't be disappointed if you get a bit frustrated.
2007-01-23 18:21:43
·
answer #2
·
answered by Buck Boy 2
·
0⤊
0⤋
Are you familiar with Arrays? If not, then read up about them.
You have pasted main, which accepts command line parameters or arguments, but is only a (1x) or 1 dimensional array. You will have to move the arguments to a (2x) 2 dimensional array. array[][]
Then, you would input the numbers when starting the programs such as c:\myprogram.exe 1 2 3 4 5 6 7 8, or input the magic squares numbers.
2007-01-23 17:54:20
·
answer #3
·
answered by Anonymous
·
0⤊
0⤋
int main(int argc, char* argv[])
This is the main function of a C++ program.
You're gathering a constant variable within the
main function which is called a command line argument.
Here is an example of using command line arguments from
one of my own bits of code.
int main(int argc, char* argv[])
{
if(argv[1] != '\0'){
if(argv[1] != '\0' && argv[2] == '\0' && argv[3] == '\0')
{
runCMD(argv[1], "", "");
exit(1);
}
else if(argv[1] && argv[2] != '\0' && argv[3] == '\0')
{
runCMD(argv[1], argv[2], "");
exit(1);
}else if(argv[1] && argv[2] && argv[3] != '\0')
{
runCMD(argv[1], argv[2], argv[3]);
exit(1);
}else{
runCMD(argv[1], "", "");
}
exit(1);
}
Play around with it. It's just an array so you can
access any of the data stored in it.
Enjoy,
- Void
2007-01-24 04:05:36
·
answer #4
·
answered by Hex 5
·
0⤊
0⤋
i dont get it..........what is magic SQ....
int main(int argc, char* argv[])??
2007-01-23 17:44:18
·
answer #5
·
answered by JC 2
·
0⤊
0⤋
wat wat wat????
2007-01-23 22:19:47
·
answer #6
·
answered by watani@sbcglobal.net 1
·
0⤊
0⤋