// BoolTest - Compare variables from the
// keyboard and store the results off
// into a logical variable
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
// set output for bool variables
// to true and false instead
// of 1 and 0
cout.setf(cout.boolalpha);
// initialize two arguments
int nArg1;
cout << "Input value: 1 ";
cin >> nArg1;
int nArg2;
cout << "Inpute value 2 ";
cin >> nArg2;
bool b;
b = nArg1 == nArg2;
cout << "The statement, " << nArg1
<< " equals " << nArg2
<< " is " << b
<< endl;
// wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;
}
and now, here are my questions:1.) what's this line for? "using namespace std;"
-- the book used this line without explaining it, I'd like to find out what this is for.
2.) I've noticed that the book used this line:
int main(int nNumberofArgs, char* pszArgs[])
whereas replacing it with:
int main()
did not return any noticeable errors or change in the nature of the program when I recompiled it. What's the use of the extra string inside those parentheses?
Thanks a bunch!
Edited by WingedPanther, 26 July 2009 - 02:29 PM.
add code tags (the # button)


Sign In
Create Account

Back to top









