getting the wrong answer

OK so i finally got the programm to open and work (sort of...) but my new problem is that the answer that i am getting is completely in correct and no were near close so if so one could look it over and tell me what i have done wrong that would be great
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
#include <iostream>
#include<fstream>
using namespace std;

class CDAccount
{
      public:
      CDAccount();
      CDAccount(int,double,double);
      
	  void set_term(int);
      void set_interest(double);
      void set_balance(double);
      void math(int,double,double);
      int get_term();
      double get_interest();
      double get_balance();
      void words (ostream& output); 
      void input (istream& inputting);
      
      private:
      int term;
      double interest_rate;
      double balance;
};
      
int main()
{
    CDAccount account1 ;
    int month;
    double rate, bal;
    account1.set_term( month);
    account1.set_interest( rate);
    account1.set_balance( bal);
    account1.get_term();
	account1.get_interest();
	account1.get_balance();
	account1.math(month, rate, bal);
	void words (ostream& output); 
	
	 
    return 0;
}


CDAccount::CDAccount()
{
term = 0;
interest_rate = 0;
balance = 0;
}

CDAccount::CDAccount(int day,double cookie,double cream)
{
term = day;
interest_rate = cookie;
balance = cream;
}


void CDAccount::set_term(int month)
{
     cin >> month;
	 term = month;
     }
    
void CDAccount::set_interest(double rate)
{
     cin >> rate;
	 interest_rate = rate;
     
     }

void CDAccount::set_balance(double bal)
{
     cin >> bal;
	 balance = bal;
    
     }

void CDAccount::math (int month,double rate,double bal)
{
	double interest;
	cout << rate << endl;
	rate = rate / 100;
	cout << rate << endl;
	interest = rate * bal * (month/12);
	cout << interest << endl;
	bal = interest + bal;
	cout << bal << endl;
	
}
int CDAccount::get_term()
{
cout << term << " term" << endl;
return term;
}

double CDAccount::get_interest()
{
 cout << interest_rate << " rate" << endl;
return interest_rate;
}

double CDAccount::get_balance()
{
cout << balance  << " balance" << endl;
return balance;
}

void words (ostream& output)
{
  int month;
  double bal;
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(2);
	 output <<" when your CD matures in" << month << "months, \n";
	  output << "it will have a balance of $" << bal <<endl;
}












> the answer that i am getting is completely in correct
in those cases you need to provide an example input/output

please bother yourself to read the warnings
foo.cpp: In function ‘int main()’:
foo.cpp:32:27: warning: ‘month’ is used uninitialized in this function [-Wuninitialized]
foo.cpp:33:30: warning: ‘rate’ may be used uninitialized in this function [-Wmaybe-uninitialized]
foo.cpp:34:28: warning: ‘bal’ may be used uninitialized in this function [-Wmaybe-uninitialized]
foo.cpp: In function ‘void words(std::ostream&)’:
foo.cpp:118:41: warning: ‘month’ is used uninitialized in this function [-Wuninitialized]
foo.cpp:119:45: warning: ‘bal’ is used uninitialized in this function [-Wuninitialized]
Topic archived. No new replies allowed.