Click here to Skip to main content
16,010,392 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralFirewall opinion Pin
Matt Newman4-Jan-03 14:10
Matt Newman4-Jan-03 14:10 
GeneralRe: Firewall opinion Pin
Stefan Pedersen5-Jan-03 5:56
Stefan Pedersen5-Jan-03 5:56 
GeneralRe: Firewall opinion Pin
Matt Newman5-Jan-03 8:58
Matt Newman5-Jan-03 8:58 
GeneralRe: Firewall opinion Pin
Stefan Pedersen5-Jan-03 9:29
Stefan Pedersen5-Jan-03 9:29 
GeneralAutocomplete Pin
(Steven Hicks)n+14-Jan-03 12:08
(Steven Hicks)n+14-Jan-03 12:08 
Generalmakefile project Pin
kemu4-Jan-03 9:48
kemu4-Jan-03 9:48 
Generaltoolhelp32 Pin
Joerg Wiedenmann4-Jan-03 9:05
Joerg Wiedenmann4-Jan-03 9:05 
GeneralProblem with function output Pin
theodoreodeluga4-Jan-03 8:37
theodoreodeluga4-Jan-03 8:37 
Hi there,

Can anyone help me with this program? It compiles perfectly in Visual C++ without any errors or warnings. It runs fine too but instead of showing the results of calculations from 2 of it's functions, it outputs the value of their memory addresses (that's what I think the output is). I've copied all the code below.
Thanks.

#include <iostream>
using namespace std;


class PayDay
{
public:
double HoursWorked(double Hours);
double PayRate(double Rate);
double GetSalary();
double PayTax();

private:
double Hours;
double Rate;
double Tax;
};

int main()
{
PayDay weeklyPay;

double Hours = 0;
double Rate = 0;
double Tax;

Tax = Hours * Rate * 25 / 100;

cout << "Enter your hours:" << endl;
cin >> Hours;
cout << "Enter your pay rate:" << endl;
cin >> Rate;
cout << "This week's payroll information:" << endl;
cout << "Your gross weekly salary is:" << "$:" << weeklyPay.GetSalary() << endl;
cout << "Your net weekly salary is:" << "$:" << weeklyPay.PayTax() << endl;
return 0;
}


double PayDay::HoursWorked(double Hours)
{
return Hours = Hours;
}

double PayDay::PayRate(double Rate)
{
return Rate = Rate;
}

double PayDay::GetSalary()
{
return Hours * Rate;
}



double PayDay::PayTax()
{
return Hours * Rate - Tax;
}


GeneralRe: Problem with function output Pin
Chris Losinger4-Jan-03 10:35
professionalChris Losinger4-Jan-03 10:35 
GeneralSave Html Source Pin
Nexus4-Jan-03 5:34
Nexus4-Jan-03 5:34 
GeneralRe: Save Html Source Pin
Stephane Rodriguez.4-Jan-03 8:00
Stephane Rodriguez.4-Jan-03 8:00 
Generalruntime settings Pin
Silverthread4-Jan-03 4:31
Silverthread4-Jan-03 4:31 
GeneralRe: runtime settings Pin
Michael Dunn4-Jan-03 5:03
sitebuilderMichael Dunn4-Jan-03 5:03 
GeneralNew/Old Button's Style Pin
atanas.bakalov4-Jan-03 1:51
atanas.bakalov4-Jan-03 1:51 
GeneralRe: New/Old Button's Style Pin
Gary R. Wheeler4-Jan-03 2:53
Gary R. Wheeler4-Jan-03 2:53 
GeneralRe: New/Old Button's Style Pin
atanas.bakalov4-Jan-03 8:59
atanas.bakalov4-Jan-03 8:59 
GeneralRe: New/Old Button's Style Pin
Gary R. Wheeler5-Jan-03 1:46
Gary R. Wheeler5-Jan-03 1:46 
QuestionIDE auto complete problem? Pin
billhao4-Jan-03 0:51
billhao4-Jan-03 0:51 
AnswerRe: IDE auto complete problem? Pin
Gary R. Wheeler4-Jan-03 3:00
Gary R. Wheeler4-Jan-03 3:00 
GeneralRe: IDE auto complete problem? Pin
billhao4-Jan-03 3:09
billhao4-Jan-03 3:09 
Generaltimer control as vb !!!!!!!!!!!!!!!!!!!!!!!! Pin
xxhimanshu3-Jan-03 22:39
xxhimanshu3-Jan-03 22:39 
GeneralRe: timer control as vb !!!!!!!!!!!!!!!!!!!!!!!! Pin
User 66584-Jan-03 3:35
User 66584-Jan-03 3:35 
GeneralRe: timer control as vb !!!!!!!!!!!!!!!!!!!!!!!! Pin
Michael Dunn4-Jan-03 5:15
sitebuilderMichael Dunn4-Jan-03 5:15 
GeneralRe: timer control as vb !!!!!!!!!!!!!!!!!!!!!!!! Pin
xxhimanshu5-Jan-03 18:15
xxhimanshu5-Jan-03 18:15 
GeneralChange button caption problem Pin
Mazdak3-Jan-03 21:30
Mazdak3-Jan-03 21:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.