Menu, how to put calculation in there

so, this is my coding.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include<iostream.h>
#include<fstream.h>
#include<stdlib.h>
#include<iomanip.h>
    using std::cout;
    using std::cin;
    using std::endl;
    
    struct menu
	typedef struct menu RECORD;
	void addRecord(RECORD input[], int arraycounter);
	void printRecord( input[]);	
	void printAllRecord( input[]);
	
int main()
{
    fstream submit;
	submit.open("D:jualan.dat",ios::out);
	
    {
    int menuEnter;
    int arraycounter=0;
    
    do
    {
    cout<<"\tFamily Outfit Shop"<<endl;
    cout<<"\t    MAIN MENU"<<endl;
    cout<<"\t-------------------"<<endl;
    cout<<" 1 = Add a record\n";
    cout<<" 2 = Displays sales report for a category\n";
    cout<<" 3 = Displays sales report for all category\n";
    cout<<" 4 = Exit";
    cout<<"\nEnter Menu Number : ";
    cin>> menuEnter;
     
    if(menuEnter == 1 )
    addRecord;
    else if (menuEnter == 2 )
    printRecord;
    else if (menuEnter == 3)
    printAllRecord;
    } while (menuEnter!=4);
    return 0;
    }
     
	void addRecord(RECORD input[], int arraycounter);
    {
    char codeCate; // code category
    char codeNumbCate;  // code number category

    cout<<"Enter code category : \n";
    cin>>input[arraycounter].codeCate;
    cout<<"Enter code number of category : \n";
    cin>>input[arraycounter].codeNumbCate;
    arraycounter++;
    }
     
	void printRecord(RECORD input[]);
    {
     
    cout<<"SALES REPORT FOR "<<explanation<<endl;
    cout<<"\nItem Number\t\tPrice" << endl;
    cout<<"------------------------------"<<endl;
    cout<<codeCate<<"\t\t"<<price<<endl;
    cout<<"------------------------------"<<endl;
    cout<<"Total Sales\t\t"<<totalSales<<endl;
    cout<<endl;
    }

	void printAllRecord(RECORD input[]);
    {
    cout<<"SALES REPORT FOR ALL CATEGORIES"<<endl;
    cout<<"\nCategory\t\tSales" << endl;
    cout<<"------------------------------"<<endl;
    cout<<explation<<"\t\t"<<price<<endl;
    cout<<"------------------------------"<<endl;
    cout<<"Total Sales\t\t"<<totalSales<<endl;
    cout<<endl;
    }
}


error? yes, it is, bcoz i still did not finish it...
still, i'm running doing this coding and keep doing it, but i need help.
i keep doing mine, still someone must help me.
i will post update for my new coding...

there is the question. sorry bcoz it is long.

Family Outfit Shop decided to create a computerized system to maintain the shop inventory. The shop sells variety of garments and the garments are categorized to a particular group. Each category is given a code and the explanation for each code is given bellow.


CODE | EXPLANATION
A | baby wear
B | children wear
C | ladies wear
D | menswear

You as a programmer are required to write a program which contains a menu as bellow:

Family Outfit Shop
MAIN MENU
1)Add a record
2)Display sales report for a category
3)Display sales report for all category
4)Exit


Guideline
The program should give the user an option to choose any sub menu and it would only stop when the user choose the Exit sub menu.

1)Add a record
This sub menu will add a sales record for a particular garment into a file name jualan.dat. Each record consists of three fields which are item number, item code and price. The user may add more than one record at a time. You can use a sentinel value to control the loop. Assumed that file jualan.dat already exists. Example of file jualan.dat is shown as bellow:
A101= A =10.00
B101= B = 12.00
A102 =A= 5.00
B105= B = 17.00
C103 =C= 40.00
D101 =D = 15.00
B104 =B =20.00


2)Display sales report for a category
In this sub menu the sales report of a particular category will be displayed. The category shall be chosen by the user.

SALES REPORT FOR BABY WEAR
Item Number | Price
A101 | 10.00
A102 | 5.00
Total Sales | 15.00


3)Display sales report for all category
In this sub menu the sales report for all the categories will be displayed.

SALES REPORT FOR ALL CATEGORIES
Category Sales
Baby wear 15.00
Children wear 49.00
Ladies wear 40.00
Menswear 15.00
Total Sales 119.00


4)Exit
End of program.



so, how / where to put claculation in there?
i means, in record or print...
i try....
and also, how to display multiple of item number?
Last edited on
seriously anybody?
You should learn the semantics. You can't define functions inside functions (and what you've got aren't definitions).

I don't understand your questions.
seriously?
Topic archived. No new replies allowed.