Hi there somebody please help me to create a record file using c++..
The project is similar to a record. Ex. A product(goods) record. Where you can search for a certain product using the code number of the product, add product, remove product and view all the records.
the task is develop a similar application.

Recommended Answers

All 10 Replies

The first step is to create a structure or class for the record. After that you can determine the file format. Finally, write each of the functions that add, insert, modify and delete records. Write and test these just one function at a time so that you don't get overwhelmed with the complexity of the program.

The first step is to create a structure or class for the record. After that you can determine the file format. Finally, write each of the functions that add, insert, modify and delete records. Write and test these just one function at a time so that you don't get overwhelmed with the complexity of the program.

hod do i create a structure i mean the code.i didnt know where i should start or what to write..:(

hod do i create a structure i mean the code.i didnt know where i should start or what to write..:(

i will used 3 arrays(price.name of the products,code number)

Here is an example of how to write a structure

The first step is to create a structure or class for the record. After that you can determine the file format. Finally, write each of the functions that add, insert, modify and delete records. Write and test these just one function at a time so that you don't get overwhelmed with the complexity of the program.

hi there this is my code my problem is how do i organize this..there's a lot of error..please help me..

#include<iostream>
using namespace std;

main()
{
//menu
//\t - tab
    //string CornedBeef,Ham,CornedTuna,BeefLoaf,Sardines;
    string ProductName[100];
    int Price[100];
    int ProductCode[100];
    char ans;



    do
        //{
        cout<<"\t     Welcome My CompAny "<<endl<<endl
            <<"\t     Pls Choose your transactions below"<<endl<<endl
            <<"\t      <S>Search a Product"<<endl<<endl 
            <<"\t      <A>Search The Price List"<<endl<<endl
            <<"\t      <B>Search The Code"<<endl<<endl
            <<"\t\t\t   Transactions: ";
       char Transactions;
       cin>>Transactions;

ProductCode[0] = 9702146;
ProductCode[1] = 9700201;
ProductCode[2] = 9702147;
ProductCode[3] = 9700202;
ProductCode[4] = 9702148;


ProductName[0] = "CornedBeef";
ProductName[1] = "CornedTuna";
ProductName[2] = "Ham";
ProductName[3] = "BeefLoaf";
ProductName[4] = "Sardines";

int r = 6;
int i = 6;
{
for(i=0;i<r;i++)
{
    cout<<"The ProductName with the ProductCode "<<" "<<" is "<<" "<<endl;
}
}
           
 
        if(Transactions=='s')
            {
                ProductName[0] = "CornedBeef";
                ProductName[1] = "CornedTuna";
                ProductName[2] = "Ham";
                ProductName[3] = "BeefLoaf";
                ProductName[4] = "Sardines";
                cout<<"The ProductName with the ProductCode "<<" "[i]<<" is "<<" "[i]<<endl;
                cout<<endl;

            }

        else if(Transactions=='a')
           {
           0;
           1;
           2;
           3;
           4;
            }

        else if(Transactions=='b')
            {
                ProductCode[0] = 9702146;
                ProductCode[1] = 9700201;
                ProductCode[2] = 9702147;
                ProductCode[3] = 9700202;
                ProductCode[4] = 9702148;
               cout<<endl;
                
            }
        else
            {
                ProductName[0] = "0";
                ProductName[1] = "1";
                ProductName[2] = "2";
                ProductName[3] = "3";
                ProductName[4] = "4";
                cout<<endl;
            cout<<endl;
            cout<<"\t\t\tProductName         : "<<"CornedBeef" <<endl
                <<"\t\t\tProductName         : "<<"CornedBeef"<<endl<<endl
                <<"\t\t\tProductName              :"<<"Ham"<<endl
                <<"\t\t\tProductName          : "<<"Sardines"<<endl
                <<"\t\t\tProductName           : "<<"BeefLoaf"<<endl<<endl
                <<"\t\tDo you want to continue? (y-yes)";
                cin>>ans;
                system("cls");
        }while(ans=='y');
        
        return 0;
}

What do you propose that lines 64-68 are doing?

You've got a mismatch with your braces, too.

I think you're best off doing some reading or tutorials first, plan out your code with pencil and paper, and then do the coding.

I'm sure std map does all that for you. If you need duplicates, use std multi map.

What do you propose that lines 64-68 are doing?

You've got a mismatch with your braces, too.

I think you're best off doing some reading or tutorials first, plan out your code with pencil and paper, and then do the coding.

what do you mean??

Which part was unclear?

Lines 64-68 don't do anything, it's technically a valid statement when you write "0;", but why would you?

The braces that you have in the code don't match up, so an opening brace "{" has to match a closing brace "}" somewhere.

There's no ambiguity in the last part. It's not a mean sentiment, I'm just being truthful with you, you are missing fundamental concepts that need to be learned or re-learned.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.