function error?

Hey guys i am making a small finance calculator for practice , im attempting the use of functions but from my reading it looks like im doing it correctly but its not compiling any ideas ?


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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;
char cont2[50];
int multiplication(int a)
{int r;
r=a*12;
return(r);
}
int main()

{
    cout<<" Welcome to the Finance wizard "<<"\n";
    cout<<" This was created by : Seth Prado"<<"\n";
    cout<<"\n\n"<<" This program was made as a learning experience"<<"\n";
    cout<<" Please enter all amounts to the nearest dollar value"<<"\n";
    int cont;
    cout<<"\n\n"<<" MAIN MENU "<<"\n\n"<<"Press '1' to continue";
    cout<<"\n"<<"Press '2' to exit"<<"\n";
    cin>>cont;
                if (cont==1)
                {
                            goto program;
                }
                if (cont==2)
                {
                            system("PAUSE");
                            return EXIT_SUCCESS;
                }           
    /* this is the initial program , if anyone knows of a better way to get
    here instead of "" GOTO "" please let me know */
    
    program:
            system("CLS");
            
    /* this is going to be the int bank */
    int Totalincome;//Monthly
    int Electric;//electir bill
    int Gas;
    int Water;
    int tuition;
    int CarGas;
    int Cinsurance;
    int Hinsurance;
    int Rent;
    int CC1;
    int CC2;
    int CC3;
    int CC4;
    int CC5;
    int cphone;
    int Hphone;
    int Cable;
    int web;
    int GroceryCost;
    int Emed;
    int Dental;
    int Hospital;
    int Savings;
    int Leisure;
    int SecondaryIncome;
    int incomeleftm;
    int Billtotalm;
    int totsav;
    int incomelefty;
    int BillYear;
    int miscspend;
            cout<<"All fields are based monthly \n";
            cout<<"Please enter Amounts to the nearest Dollar";
            cout<<"\nIf field does not apply enter '0' \n";
            cout<<"Please enter your income amount \n";
            cin>>Totalincome;
            cout<<"Electric Bill Amount : \n";
            cin>>Electric;
            cout<<"Gas Bill Amount: \n";
            cin>>Gas;
            cout<<"Water Bill amount: \n";
            cin>>Water;
            cout<<"Tuition Payment or studen loan: \n";
            cin>>tuition;
            cout<<" Enter amount for vehicle fuel (monthly : \n";
            cin>>CarGas;
            cout<<"Car insurance payment : \n";
            cin>>Cinsurance;
            cout<<"Home Insurance payment : \n";
            cin>>Hinsurance;
            cout<<"Home Payment / Rent : \n";
            cin>>Rent;
            cout<<"Credit card payment no.1 : \n";
            cin>>CC1;
            cout<<"Credit card payment no.2 : \n";
            cin>>CC2;
            cout<<"Credit card payment no.3 : \n";
            cin>>CC3;
            cout<<"Credit card payment no.4 : \n";
            cin>>CC4;
            cout<<"Credit card payment no.5 : \n";
            cin>>CC5;
            cout<<"Cell Phone payment : \n";
            cin>>cphone;
            cout<<"House Phone payment : \n";
            cin>>Hphone;
            cout<<"Cable tv payment : \n";
            cin>>Cable;
            cout<<"Internet Bill : \n";
            cin>>web;
            cout<<"Estimated grocery / misc supply cost : \n";
            cin>>GroceryCost;
            cout<<"Medical Bill for vision: \n";
            cin>>Emed;
            cout<<"Medical Bill for dental: \n";
            cin>>Dental;
            cout<<"Medical Bill for hospitals+misc med: \n";
            cin>>Hospital;
            cout<<"Amount wanting to save monthly : \n";
            cin>>Savings;
            cout<<" Fun money / Leisure spending allowed for month: \n";
            cin>>Leisure;
            cout<<" Amount of money having pitched in *roomates* : \n";
            cin>>SecondaryIncome;
            cout<<" Amount of any other bills / deductions \n";
            cout<<" that does not apply in above fields: \n";
            cin>>miscspend;
            cout<<"Would you like to see your estimated finances? ";
            cout<<"\n Type ' Yes ' or ' No ' \n ";
            cin>>cont2;
                    
                    if (!strcmp("Yes", cont2)){;
                            system ("CLS");}
            cout<<"  \n\n\n\n Your Monthly Finances in totals : \n";
            
            /* ALL Expenses are entered ^^^ all below will be formulas for
            totals */
            
            Billtotalm=(Electric+Gas+Water+tuition+CarGas+Cinsurance+
            Hinsurance+Rent+(CC1)+(CC2)+(CC3)+(CC4)+(CC5)+(cphone)+Hphone+Cable+
            web+GroceryCost+Emed+Dental+Hospital+Savings+Leisure+miscspend);
            
            incomeleftm=(Totalincome+SecondaryIncome)-Billtotalm;
            // Monthly Bill total and leftover income
            cout<<" Your total amount spent on bills for the month is: \n";
            cout<<Billtotalm;
            cout<<" The total amount of money you have left over monthly";
            cout<<" is : \n"<<incomeleftm;
            cout<<"\n\n\n\n";
            cout<<" Would you like to see your *estimated* Yearly expenses?";
            cout<<"\n"<<" Type ' Yes or No' \n";
            cin>>cont2;
              if (!strcmp("Yes", cont2));
                            system ("CLS");}

//this area below is where i think i am having the trouble
                         
           int CalculateEstimatedYearlySaving(int Savings)
            {
               return Savings * 12;           
            }
            cout<<CalculateEstimatedYearlySaving;  
            
            int CalculateEstimatedBillYearly(int Billtotalm)
            {    
                return Billtotalm * 12;
            }
            cout<<CalculateEstimatedBillYearly;
            
            int CalculateEstimatedLeftYearly(int incomeleftm)
            {
                return incomeleftm * 12;
            }
            cout<<CalculateEstimatedLeftYearly;
    system("PAUSE");
    return EXIT_SUCCESS;

'return' isn't a function, delete the braces on Line 10.
LEISURE PROGRAMS\Finance WIzard.cpp expected constructor, destructor, or type conversion before '<<' token

im getting this error on lines 160,166,172 after deleted ' return' on line 10
You're not using functions correctly. You should define them outside of 'main()' and you can either save the data returned from them to a variable or you can pipe it right to cout but what you're trying to do on lines 160, 166 and 172 is confused.
Topic archived. No new replies allowed.