Question: I need to write a c program for a shoping list to run on ocelot. #include #include #include struct ShoppingList { int itemNum; char description[40];
I need to write a c program for a shoping list to run on ocelot.
#include
struct ShoppingList { int itemNum; char description[40]; double price; int count; double extendedPrice; };
int main(void) { struct ShoppingList list[5]; //Item Num 1 list[0].itemNum = 345; strcpy(list[0].description, "Bookshelf"); list[0].price = 78.50; list[0].count = 4; //Item num 2 list[1].itemNum = 7474; strcpy(list[1].description ,"Pen"); list[1].price = 2.99; list[1].count = 100; //Item num 3 list[2].itemNum = 987; strcpy(list[2].description,"Chair"); list[2].price = 129.99; list[2].count = 6; //Item num 4 list[3].itemNum = 2342; strcpy(list[3].description ,"Camera"); list[3].price = 1295.40; list[3].count = 3; //Item num 5 list[4].itemNum = 2731; strcpy(list[4].description, "Table"); list[4].price = 185.40; list[4].count = 2; printf("Item Num Description Price Count Extended Price "); for(int i=0; i<5; i++) { int counter = 0; char buffer[7]; snprintf(buffer, 10, "%d", list[i].itemNum); counter = strlen(buffer); char zeros[7] = ""; while(counter<6) { strcat(zeros,"0"); counter++; } printf("%s%d %s $%.2f %d $%.2f ",zeros,list[i].itemNum, list[i].description,list[i].price, list[i].count, list[i].price*list[i].count); } return 0; }
as you can see i have the program done correctly and complete
the only part im confused about is ocelot
the program should be able to run on ocelot and im supposed to create a simple Makefile to compile your program into an executable called shopping. however I have no idea what that means or how to do it.
im supposed to submit the source code, makefile and screenshot of the output file. compressed into a zip.
someone should be able to type make at the command line to compile the program.
i have the code written and it works i just have no clue how to see if it runs on ocelot or even how to begin doing that. I also dont understand the park about a makefile and typing make at the comman line to compile the program.
could someone please help me test if the program runs on ocelot, or better yet give a detailed description on what all of those things mean and how i can do them.
please help
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
