#include %26lt;iostream%26gt;
using namespace std;
int main(int argc, char *argv)
{
cout %26lt;%26lt; "This will contain numbers 1-10:\n";
for(int i = 1; %26lt;= 10; i++)
cout %26lt;%26lt; i %26lt;%26lt; endl;
return 0;
}
What's wrong with this C++ program?
The only critical error is in the syntax of the
termination condition of the "for" loop. There's
a typo such that it only says:
%26lt;= 10
and it should be:
i %26lt;= 10
There's a technical (but in this case unimportant)
error in that the prototype for "main" should be:
int main(int argc, char* argv[])
Note that the second parameter is not a pointer
to char, but rather a pointer to array of char.
The repaired code looks like:
#include %26lt;iostream%26gt;
using namespace std;
int main(int argc, char *argv[])
{
cout %26lt;%26lt; "This will contain numbers 1-10:\n";
for(int i = 1; i%26lt;= 10; i++)
cout %26lt;%26lt; i %26lt;%26lt; endl;
return 0;
}
Reply:where it says ''argc'' it should say ''arge''
Reply:You're missing the "i" before expression "%26lt;=10"
corrected:
for(int i = 1; i %26lt;= 10; i++)
800flowers.com
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment