Welcome to Dream.In.Code
Become a C++ Expert!

Join 136,917 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,741 people online right now. Registration is fast and FREE... Join Now!




cant pass stuct and retun struct parameter caus of external build prob

 
Reply to this topicStart new topic

cant pass stuct and retun struct parameter caus of external build prob, Cprograming

SweepX
1 Apr, 2008 - 09:08 AM
Post #1

New D.I.C Head
*

Joined: 1 Apr, 2008
Posts: 1

this is my code when i run the code in visual C++ 6 i get the following errors:

--------------------Configuration: flight prog - Win32 Debug--------------------
Linking...
flight prog.obj : error LNK2001: unresolved external symbol "struct flights __cdecl menuii(struct flights)" (?menuii@@YA?AUflights@@U1@@Z)
flight prog.obj : error LNK2001: unresolved external symbol "struct flights __cdecl seat_to_0(struct flights)" (?seat_to_0@@YA?AUflights@@U1@@Z)
Debug/flight prog.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

flight prog.exe - 3 error(s), 0 warning(s)

I cant seem to figure out wat im doing wrong can some one help me plez id aprciate it !!

#include<stdio.h>
#include<conio.h>

#define cap 250

// the stuct format allows many fils under one name(tag)used with the type def u can make it possible for much more uses
typedef struct
{
char fname[10];
char lname[10];
char address[30];
int phone;
int seat;
int flightnum;
}flights;
flights plane1[cap],plane2[cap],plane3[cap];

flights menuii(flights);
flights perinfo(flights);
flights seat_to_0(flights);
int secfull(int);
int menu(int);

void main()
{
int opt;
do{
printf("****************\n");
printf("* 1 for plane1 *\n");
printf("* 2 for plane2 *\n");
printf("* 3 for plane3 *\n");
printf("* 4 to exit *\n");
printf("****************\n");
scanf("%d",&opt);

if (opt==1)
menuii(plane1[cap]);
else if (opt==2)
menuii(plane2[cap]);
else if(opt==3)
menuii(plane3[cap]);
else if(opt!=4)
printf("Invalid imput please enterone of the options from the menu\n");
}while(opt!=4);


}//end main

flights menuii(flights passmani[cap])
{
int select,i,fcnonsmok,fcsmok,enonsmok,esmok;
fcnonsmok=0;
fcsmok=50;
enonsmok=100;
esmok=175;
select=0;

/* initializes all seats to zero*/
seat_to_0(passmani[cap]);

for(i=0;i<cap;i++)
{

printf("Please enter the corresponding number to where u would like to be seated\n");
printf("*****************************************\n");
printf("* 1 for Smoking First Class *\n");
printf("* 2 for Non somking First Class *\n");
printf("* 3 for Smoking Economy *\n");
printf("* 4 for Non Smoking economy *\n");
printf("*****************************************\n");
scanf("%d",&select);

if(select==1)
{
if (fcnonsmok>=2)
{ secfull(i);
--i;
}
else
{
fcnonsmok=fcnonsmok+1;
passmani[i].seat=fcnonsmok;
perinfo(passmani[i]);
printf("Your seat Number is %d\n",passmani[i].seat);
}
}
else if (select==2)
{
if (fcsmok==100)
secfull(i);
else
{
fcsmok=fcsmok+1;
passmani[i].seat=fcsmok;
perinfo(passmani[i]);
printf("Your seat Number is %d\n",passmani[i].seat);
}
}
else if(select==3)
{
if (enonsmok==175)
secfull(i);
else
{
enonsmok=enonsmok+1;
passmani[i].seat=enonsmok;
perinfo(passmani[i]);
printf("Your seat Number is %d\n",passmani[i].seat);
}
}
else if(select==4)
{
if(esmok==cap)
secfull(i);
else
{
esmok=esmok+1;
passmani[i].seat=esmok;
perinfo(passmani[i]);
printf("Your seat Number is %d\n",passmani[i].seat);
}
}
else
{printf("You enter an invalid input please enter one from the menu a\n");
i=--i;
}
printf("i is %d",i);

printf("\n& #092;n**************************************************************************
*****\n\n");

}//end fight #control
return passmani[cap];
}//end menuii

flights perinfo(flights passmani)
{
printf("Enter the following information\n");
printf("First Name:");scanf("%s",&passmani.fname);
printf("Last Name:");scanf("%s",&passmani.lname);
printf("Address:");scanf("%s",&passmani.address);
printf("Phone#:");scanf("%d",&passmani.phone);

return passmani;
}// end persons info

int secfull(int x)
{int c;
printf(" Sorry but this section is full, do u which to be placed in another section\n");
printf("if you do please enter 1 if not then enter 2\n");
scanf("%d",&c);
if (c==1)
--x;

else if(c==2)
{printf("NEXT FLIGHT LEAVES IN 3 HOURS\n");
}
return x;
}// end section full


flights seat_to_0(flights popseat[cap])
{
int y;
for(y=0;y<cap;y++)
{popseat[y].seat=0;
}
return popseat[cap];
}//end seat_to_0

User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/3/08 10:08PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month