Question: For some reason the code stops working after I input how many ship parts I want to buy and and says it exits with a
For some reason the code stops working after I input how many ship parts I want to buy and and says it exits with a non zero status. How do I fix this? Thank you.
Share ork nput a clear gce version 4.6.3 7 8 9 10 //Included Libraries #include #include #include You may now take your ship and erew Erom Port Marin,Spain to the hidden island in the caribbean on the old pirate's map How will you trave1? 1 Aa a merehant 2-As a privateer 3- As a pirate 12 /Constants for Arrays 13 #define STRENGTH 30 14 #define NUMCREW5 15 define NUMSUPPLIES 4 As a nerchant, you begin your trip with 1000 gold pieces. You will be sailing your Carrack, with an average speed of 0 miles per day What is your nase, Captain? 17 /Constants for Distances (neasured in ailes) 18 #define CANARY 1261 19 #define GRENADA 3110 20 adefine FINAL 50 21 define DISTANCE 4871 Who are the other menbers of your 23 //Function Signatures - do not change these 24 void setuplchar crewnanes [NUMCREW] ISTRLENGTH1, int crewstatus [NUMCREW], int supplies [NUMSUPPLIES], int captaintype, int funds, int "distanc eperday); Before leaving Port Harin, you should purchase sone suppliea 25 int countcrewlint crewstatus INUMCREW]): 26 void printstatus(char crewnanes INUMCREW1 ISTRLENGTH], int crewstatus INUMCREW]): 27 void getsupplies(char supplytypes [NUMSUPPLIES] ISTRLENGTH], int supplies [NUMSUPPLIES], int funds): 28 void dailyreport(char crewnanes INUMCREWI ISTRLENGTH], int crewstatus INUMCREW), int supplies [NUMSUPPLIES, int You have 1000 gold coins. Available Supplies: 1. Food 1 gold pieces 2. Clothes 2 gold pieces 3. Ship Parts - 20 gold pleces funds, int traveled); 29 void rest(int supplies [NUMSUPPLIES], char crevnanes INUMCREW] (STRLENGTH), int crewstatus (NUMCREM), int days): 30 int fish): 31 int max(int a, int b); 32 int min(int a, int b); 33 void event (char crewnanes (NUMCREWI ISTRLENGTH], int crewstatus INUMCREW], int -days, int supplies INUMSUPPLIES]): Shovels 10 gold pieces 5 Leave Store 293092780 llow many extra ship parts do you want to buy? 35 //Main function -This is the final version of main. Any changes you make white 36 /creating the functions should be renoved prior to submission. 37 int nain(void) //crewnanes and supplytypes are arrays of strings to store the nanes of the crew menbers //and the types of supplies that can be purchased and taken on the voyage char crewnanes (NUMCREW ISTRLENGTH] char supplytypes[MPSUPPLIES][STRLENGTH] ("Food". "Clothes", "Ship Parts", "Shovels"); /stop indicates whether or not the user would Like to stop at a port //crewstatus indicates the status of each crew nember, corresponding to the order of nanes //supplies has a total for each type of supply, corresponding to the order of supplies char stop