In article <pa****************************@gmail.com>,
arnuld <ge*********@gmail.comwrote:
STATEMENT: write a main function that takes two vales as arguments and
print their sum.
the main takes classic arguments ;) int main( int argc, char **argv )
1st argument is an int while 2nd argument is an array of string literals.
how am i supposed to add a string literl to an int ?
Try this:
int main( int argc, char* argv[] )
{
for ( int i = 0; i < argc; ++i )
cout << argv[i] << '\n';
}
Then run your program using:
program 1 2
You should end up with the following output:
program
1
2
Now all you have to do is figure out how to add the 1 and 2 to produce 3
and output it instead.