|
From: Carlos d. M. <cg...@wo...> - 2002-09-07 19:41:03
|
You mispelled the statement, the firt semicolon is a comma (,) so you
have a first field with two assigments, the second with a condition and
the third with the operation.
tam...@ms... escribi=F3:
> Hey guys I'm still very green at this and I just inputted a small
> program (listed below) from "Teach Yourself C++", and when I try to
> compile it gives me errors LINE 26 PARSE ERROR
> BEFORE ';' LINE 30 PARSE ERROR BEFORE ';'I took
> the int i and the ++ off both lines and the program compiled but
> didn't work properly. I was wondering is the book wrong or am I doing
> something wrong? #include <iostream>
> char msg[] =3D "Now is the time\n";int main()
> {
> char* cp; //---a pointer to char
> int i; //---an integer subscript
>
> //---Pointer access, pointer notation
> for (cp =3D msg; *cp; cp++)
> std::cout << *cp;
>
> //---Subscript access, subscript notation
> for (i =3D 0; msg[i]; i++)
> std::cout << msg[i];
>
> //---Pointer access, subscript notation
> for (cp =3D msg; cp[0]; cp++)
> std::cout << cp[0];
>
> //---Subscript access, pointer notation
> for (i =3D 0; *(msg+i); i++)
> std::cout << *(msg+i);
>
> //---Pointer and subscript access, pointer notation
> for (i =3D 0; cp =3D msg; *(cp+i); i++)
> std::cout << *(cp+i);
>
> //---Pointer and subscript access, subscript notation
> for (i =3D 0; cp =3D msg; cp[i]; i++)
> std::cout << cp[i];
>
> //---system pause
> char end;
> std::cin >> end;
> return 0;
> }
>
|