"Alf P. Steinbach" <al***@start.no> wrote in message
news:41*****************@news.individual.net...
* Ron Natalie: Sayajin wrote: > Hi,
>
> is this a "good" tutorial on C++ :
> http://www.functionx.com/cpp/index.htm
>
> Thanks
>
>
Better than some, but still could use with some proofreading
by someone who actually KNOWS the language. Lots of mistakes
and misinformation in the first two chapters I read.
From the first chapter:
<quote>
The libraries are (also) called header files and, as computer files,
they have the extension ".h". An example would be house.h, or person.h.
As you see, they could have any name; when you start creating your own
libraries, you will give your files custom and recognizable names.
The first library we will be interested in is called iostream. It asks
the computer to display stuff on the monitor's screen.
To see how to put a library in your program, you put it at the beginning
of the file. Here is an example
include iostream.h
</quote>
It's difficult to know where to begin when the author's understanding is
so warped; I think I pass on this one...
From lesson 12 - Dynamic Multi-Dimensional Arrays
int main()
{
int *pNumbers[2];
*pNumbers = new int[0]; // it allocates a vector of size 0
(*pNumbers)[0] = 31; // core dump
(*pNumbers)[1] = 29; // core dump
(*pNumbers)[2] = 31; // core dump
(*pNumbers)[3] = 30; // core dump
(*pNumbers)[4] = 31; // core dump
(*pNumbers)[5] = 30; // core dump
*(pNumbers+1) = new int[1]; // it allocates a vector of size 1
(*(pNumbers+1))[0] = 31; // we are lucky
(*(pNumbers+1))[1] = 31; // core dump
(*(pNumbers+1))[2] = 30; // core dump
(*(pNumbers+1))[3] = 31; // core dump
(*(pNumbers+1))[4] = 30; // core dump
(*(pNumbers+1))[5] = 31; // core dump
cout << "List of Numbers";
cout << "\n(*pNumbers)[0] = " << (*pNumbers)[0];
cout << "\n(*pNumbers)[1] = " << (*pNumbers)[1];
cout << "\n(*pNumbers)[2] = " << (*pNumbers)[2];
cout << "\n(*pNumbers)[3] = " << (*pNumbers)[3];
cout << "\n(*pNumbers)[4] = " << (*pNumbers)[4];
cout << "\n(*pNumbers)[5] = " << (*pNumbers)[5] << endl;
cout << "\n(*(pNumbers+1))[0] = " << (*(pNumbers+1))[0];
cout << "\n(*(pNumbers+1))[1] = " << (*(pNumbers+1))[1];
cout << "\n(*(pNumbers+1))[2] = " << (*(pNumbers+1))[2];
cout << "\n(*(pNumbers+1))[3] = " << (*(pNumbers+1))[3];
cout << "\n(*(pNumbers+1))[4] = " << (*(pNumbers+1))[4];
cout << "\n(*(pNumbers+1))[5] = " << (*(pNumbers+1))[5] << endl;
delete [] *pNumbers;
delete [] *(pNumbers+1);
return 0;
}
Fabio
Italy