RE: [Dev-C++] newbie questions without answer
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ho...> - 2002-08-11 16:03:12
|
<http://run.to/noicys>=20 -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Carlos Garc=EDa del Monte Sent: Sunday, August 11, 2002 3:49 PM To: dev-cpp-users-list Subject: Re: [Dev-C++] newbie questions without answer =20 newbiequestion.cpp=20 struct employ{=20 char *first;=20 char *second;=20 date eyear; /*i want to use a reference to the year in the first struct =20 I do not see any reference here. Also what first struct? =20 =20 but then i get an error message from the compiler since i didn't=20 initialize eyear!! how am i to get rid of this problem??*/=20 =20 Provide a default constructor or default arguments to the provided constructor. =20 =20 I have no problems compiling it.=20 employvar.eyear.(day/month/year)=3D x; =20 That's a bit strange. =20 =20 Or=20 date *eyear=20 employvar.eyear->day=3Dx.=20 Or=20 date *eyear; in employer struct.=20 datevar.day =3D x;=20 employvar.eyear =3D datevar;=20 Or datevar.day=3Dx;=20 datevar.eyear =3D &datevar; =20 I hope you know what you are doing in the above. =20 =20 The other question about shorter way. I don't understand.=20 In the stringclass what happens is that when you modify the +=3D = operator, so the string of the left hand string object is no midified you make that neither it size is modified (evidently), but then, ine the code, at line 178 - 190, the code assumes that function has not been changed (you did not adapted it to your modifications), so as it wants to output the substrings from a subscript to another position, and the positions are not found through object's functions, they are put ad hoc, the code at this lines are intended so you had just added s2 to s1, so s1 is "happy birthday to you", which has 21 characters, and there the code is "substring from 0, 14 and after from 15, 0", which are ranges that would be in s1, but you modified it in a way such now s1 is "happy", five chars, so when you ask for range 15,0 you're giving a range which is out of the bounds of s1.=20 The burda nie ref var, that's the way.... =20 I am not good at understanding technical problems from text. Please provide some example code with comments. =20 =20 =20 Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net <http://www.noicys.cjb.net/>=20 * Alternative URL: http://run.to/noicys |