Please help me with this C++ project (LIBRARY OF FOODS)

a menu is a structured data that contains at lest the following fields:
Name - name of food/beverage
classification - (carbohydrates, protein, fat, vitamins and minerals)
kind - (if meat/chicken/fish/pastries/cakes/beverage and etc.)
country - the origin of the food
rating - personal score from 1 to 10
remarks - additional comments

library must be able to do the following:
1.adds a food to the menu record library . an added food should at least contain a name. the other fields can be empty when the food is initially added to the library.
2. finds a food by name. when a food is found, the food fields are updated according to the given update data. if the name does not exist in the library, no food/ beverage is changed.
3. list the food in the library according to an input query. the input query can be one of the fields and an appropriate value according to the field. example of the input data is "classification: <classification of food>" as a substring.
4. removes all the foods that have already previously been recorded into the library. a food has a duplicate it it has the same name, classification, type and origin with another already existing in the library. if there are n food with the same name, classification, kind and origin, remove the other n-1 food leaving only one food.


use LOOPING, FUNCTION, ARRAYS, STRUCT, and FILE MANAGEMENT.

--
THANKS YOU.. :)
So how much of this have u done? Post some code.
i'm not done on this project. i'm still working for it. but it was so hard . :((
we cant actually write the code for you but we can write pseudo code and give examples. post what you have. btw this sounds like a really fun project that im going to try
that's our project.. please help me, can i have your pseudocode? :D
here is some of my codes, but i dont know if this is right:
// Library_of_Food.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include<cstdlib>
#include <string>
#include <fstream>

using namespace std;

struct Add{
char name[20];
char clasi[20];
char kind[20];
char origin[20];
char remarks[20];
int star;
};

void name()
{
cout << "\n\t\t\t\"Klyde Stacy Library of Food.\"\n" << endl;

int x = 79;
while (x >= 0)
{
cout << "=";
x--;
}
}
int menu()
{
int choice;

cout << "\nACTIONS:\n1. if you want to add Food/Beverage." << endl;
cout << "2. if you want to update or find a Food/Beverage." << endl;
cout << "3. if you want see the list Food/Beverage." << endl;
cout << "4. Quit." << endl;
cout << "NOTE: Please use underscore (_) as a substitute for Space.\n" << endl;
cin>>choice;
return choice;
}



int main()
{
int terminator;
name();
terminator = menu();
const int size = 20;
//for case1
char foodName[size], clasification[size], kind[size], country[size], remarks[size];
int star;
char yesOrNo;
//for the case2
int rows=0;
char names[size];
char searchName;
char answer;


while (terminator != 4)
{
switch (terminator)
{
case 1:
Add food;
cout << "Please enter food/beverage name: ";
cin >> foodName;
strcpy(food.name, foodName);
cout << "Do you want to add something? <y/n>: ";
cin >> yesOrNo;

while(true)
{
if(yesOrNo == 'y')
{
cout << "Please enter classification of food/beverage: ";
cin >> clasification;
strcpy(food.clasi, clasification);
cout << "Please enter kind of food/beverage: ";
cin >> kind;
strcpy(food.kind, kind);
cout << "Please enter the origin of the food/beverage: ";
cin >> country;
strcpy(food.origin, country);
cout << "Please enter your additional comment about the food/beverage: ";
cin >> remarks;
strcpy(food.remarks, remarks);

while(true)
{
cout << "Please enter a star rating for the song (1 to 10 stars): ";
cin >> star;
food.star = star;
if(!cin.fail() && star >= 1 && star <= 10)
break;
else if(cin.fail())
cout << "Rating can only be the digits 1, 2, 3, 4, 5, 6, 7, 8, 9 or 10.";
else if(star < 1 || star > 10)
cout << "Rating must be between 1 and 10.";
}
break;
}
else if(yesOrNo == 'n')
break;
else
cout << "Invalid operation.\nPlease enter y to add something, or n to do nothing: ";
cin >> yesOrNo;
}

break;
case 2:
cout << "Find ";
cin >> foodName;

search(names, foodName, size);

cout << "Name: " << foodName << endl;
cout << "Classification: " << clasification << endl;

break;
case 3:

break;
case 4:
return 0;

}

terminator = menu();
cout << "\n";
}
system("pause");
return 0;
}


Please, try doing it yourself. It's basic c++ project, and you might have some hard time writing it, but eventually you will succeed and gain necessary experience...

unless of course you don't want to be software developer and this is just 'stupid homework of c++ which i wont need ever again in my lifetime' type of thing.

If it is the 2nd I can write it for you, but if it's 1st option we all here can give you clues how to start this kind of project ;).
Last edited on
two things n1) to make it easier for everyone, click edit on the post with the code, and there should be a format section with a button that looks like this <> wrap it around your code and it will look much nicer. and correct me if im wrong but cant we also write pseudo code and spaghetti code that wont work
i know now the codes for #1 and #3, but i cant finish the #2 and #4
Topic archived. No new replies allowed.