Thank you for your help. It took me a long time trying to understand what you said. Finally, I understand the meaning of the program its in my book. The program named add (which add two numbers and output the result) , and I wrote that program and use command-line to test. It works!! The sample program named add is
#include<iostream>
#include<cstdlib>
using namespace std;
int main( int argc, char *argv[])
{
double a, b ;
if (argc != 3)
{
cout << "Usage : add num num \n";
return 1;
}
a = atof ( argv [1] );
b = atof ( argv [2] );
cout << a + b ;
return 0 ;
}
But, I got some other problems...
The sample program add in my book is designed for use in command-line (at least I think that way). So, if I want to test some program from the command-line, should I always include for example like this part in my program?
int main( int argc, char * argv[])
a = atof ( argv [1] ); b = atof ( argv [2] );
And also in your explanation, you put -f filename.txt . This is text filename. What I did is just put filename and 2 numbers (add 100 200), and that files extension is .exe. I tried to use text file which I simply typed add 100 200 in the note pad and saved it with the extension .txt and put that file name in the command-line. Then what is does is just to open that file...... ( I know its stupid...)
I think I still can't fully understand what you said....(I got some)
If you have time, please help me.