How To Get The Product Code For Sygic?

Why am I getting error with this code?

  • The prompt is like this: Design and code a program that will maintain a list of product information. Use the following struct to represent the product struct Product { string productID; string productName }; and an array of Product objects to implement the list. Your program must implement the following functions: * Add a product to the list * Display the entire list * Delete a product from the list * Find a specific product given the productID. You need to create a command command loop with a menu() function. The program must continue asking for input until the user stops. Remember, you most use functions in this program. I DESIGED CODE like this: #include <iostream> #include <string> using namespace std; void Menu(); void AddToList (string [], int); void RemoveFromList(string [], int); void DisplayList(string [], int); void FindFromList(string [], int); int main() { string List[10]; int Cmd = 0; int Count, K; int MAX_LIMIT = 10; while(Cmd != 5) { Menu(); cout << "Command: "; cin >> Cmd; if (Cmd == 1) AddToList(List, MAX_LIMIT); else if (Cmd == 2) RemoveFromList(List, MAX_LIMIT); else if (Cmd == 3) DisplayList(List, MAX_LIMIT); else if (Cmd == 4) FindFromList(List, MAX_LIMIT); else exit(); } } //List the choices... void Menu() { cout <<"Choices..." << endl; cout << "==============================" << endl; cout << "Add product to list.....(1)" << endl; cout << "Remove product from list...(2)" << endl; cout << "Display entire list...(3)" << endl; cout << "Find product from list...(4)" << endl; cout << "Quit...(5)" << endl; cout << "==============================" << endl; } //Get the values from the user... void AddToList(string List[], int MaxSize) { int Count; cout << "Enter Values Below, Stop To Quit." << endl; for(Count = 0 ; Count < MaxSize ; Count++) { Cout << "Enter Value: "; cin >> List[Count]; if(List[Count] == "stop") break; } } // Remove product from list void RemoveFromList(string List[], int Size) { int K,B; int Index; string TList[10]; //temp List cout << “Enter index of product to remove : ” << endl; cin >> Index; B=0; for(K = 0 ; K < Size ; K++) { if (Index <> K) { TList[B] = List[K]; B = B + 1; } } //Fill List of product with blank for(m = 0 ; m < Size ; m++) List[m]=””; //Copy temp List to original list for(l = 0 ; l < Size ; l++) List[l] = TList[l]; cout << “Entered indexed product is remove from list” << endl; DisplayList(List, Size); } //Display product list.. void DisplayList(string List[], int Size) { cout << “List of products :” << endl; for(K = 0 ; K < Size ; K++) { cout << “At Index : ” << K << “ : “ << List[K] << endl; } } //Find product from list.. void FindFromList (string List[], int Size) { int K; int Index; cout << “Enter index of product to find : ” << endl; cin >> Index; for(K = 0 ; K < Size ; K++) { if (Index = K) { cout << “At Index : ” << K << “ : “ << List[K] << endl; break; } } }

  • Answer:

    Make the following changes, and you should be okay. '-' indicates lines to remove, '+' lines to add. The first number after the @@ is the line number. This is a standard unified diff: @@ -29,7 +29,7 @@ DisplayList(List, MAX_LIMIT); else if (Cmd == 4) FindFromList(List, MAX_LIMIT); else -exit(); +exit(0); } } //List the choices... @@ -52,7 +52,7 @@ int Count; cout << "Enter Values Below, Stop To Quit." << endl; for(Count = 0 ; Count < MaxSize ; Count++) { -Cout << "Enter Value: "; +cout << "Enter Value: "; cin >> List[Count]; if(List[Count] == "stop") break; @@ -62,7 +62,7 @@ break; void RemoveFromList(string List[], int Size) { -int K,B; +int K,B,m,l; int Index; string TList[10]; //temp List cout << "Enter index of product to remove : " << endl; @@ -70,7 +70,7 @@ cin >> Index; B=0; for(K = 0 ; K < Size ; K++) { -if (Index <> K) +if (Index == K) { TList[B] = List[K]; B = B + 1; @@ -88,6 +88,7 @@ DisplayList(List, Size); //Display product list.. void DisplayList(string List[], int Size) { +int K; cout << "List of products :" << endl; for(K = 0 ; K < Size ; K++) {

Miss Question Mark at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

Sorry, I'm not a compiler. Try downloading one and reading the error messages that you get.

Tragic Typos

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.