Jun 7, 2012 at 6:18pm UTC
You are calling a function that you told the compiler exists (the constructor of automobile), but you never actually defined it anyway.
Jun 7, 2012 at 6:19pm UTC
You promised that you would personally write the default constructor for automobile when you included the function
automobile();
in it. However, you then did not write that default constructor.
Jun 7, 2012 at 6:22pm UTC
Thanks guys simple mistake :] i also would like some support on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
case 2:
{
cout << "1. SportsCar Display" <<'\n' ;
cout<< "2. Van Display" <<'\n' ;
cout<< "3. FbyF Display" <<'\n' ;
cout<<"Enter your choice: " ;
cin >> choice3;
if (choice3 == 1)
{
string t_cr;
/*label1:*/ cout<< "Enter the registration no: " << t_cr;
for (int i=0; i<sc_count;i++)
{ if (sportcars_Arry[i]. car_registration == t_cr)
sportcars_Arry[i].displaysports_cars();
else {cout<< "No sports car exists with the specified registration number ...!!!" ;
goto /*label1;*/ }
}
}
i want it to search for the registration number but i need a different method as this isn't working.
Last edited on Jun 7, 2012 at 6:33pm UTC
Jun 7, 2012 at 8:30pm UTC
if i shouldn't use goto what other method should i use?
Jun 8, 2012 at 9:49am UTC
Control loops.
We have while , do-while , and for .
Jun 8, 2012 at 10:21am UTC
goto. isn't all that bad. Its use is handy in some scenarios:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
void Function()
{
for (/*...*/ )
{
for (/*...*/ )
{
if (SomethingFailed)
goto End;
}
}
End:
// Something...
}
Vs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
void Function()
{
bool Failed(false );
for (/*...*/ )
{
for (/*...*/ )
{
// Test if failed...
if (SomethingFailed)
{
Failed = true ;
break ;
}
}
if (Failed)
break ;
}
// Something...
}
Edit: Sorry about the spacing; Notepad++ did that.
Wazzak
Last edited on Jun 8, 2012 at 10:21am UTC