Error :) tips are welcome

Jun 7, 2012 at 6:13pm
I've been making a car rental and have came arross an error with my arrays would someone like to help me with the error please feel free to give me tips and ideas to help my code.

website + code of my system

http://codepad.org/PVNshpgK


error within visual


1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall automobile::automobile(void)" (??0automobile@@QAE@XZ) referenced in function "public: __thiscall sportscars::sportscars(void)" (??0sportscars@@QAE@XZ)
Jun 7, 2012 at 6:18pm
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
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
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
Jun 7, 2012 at 8:16pm
Don't use goto. Ever.
Jun 7, 2012 at 8:30pm
if i shouldn't use goto what other method should i use?
Jun 8, 2012 at 9:49am
Control loops.

We have while, do-while, and for.
Jun 8, 2012 at 10:21am
closed account (zb0S216C)
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
Topic archived. No new replies allowed.