Click here to Skip to main content
16,005,060 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ 4.2 smilie errors...help! - Problem Resolved. Thanks Pin
shaveyourhead28-Jan-05 5:28
shaveyourhead28-Jan-05 5:28 
GeneralSimple Calculator (Someone PLEASE HELP ME!!!!!) Pin
Atptour27-Jan-05 16:13
Atptour27-Jan-05 16:13 
GeneralRe: Simple Calculator (Someone PLEASE HELP ME!!!!!) Pin
Jim Crafton27-Jan-05 17:18
Jim Crafton27-Jan-05 17:18 
GeneralRe: Simple Calculator (Someone PLEASE HELP ME!!!!!) Pin
DHAPPREP27-Jan-05 17:55
DHAPPREP27-Jan-05 17:55 
GeneralRe: Simple Calculator (Someone PLEASE HELP ME!!!!!) Pin
David Crow28-Jan-05 3:12
David Crow28-Jan-05 3:12 
GeneralRe: Simple Calculator (Someone PLEASE HELP ME!!!!!) Pin
V.27-Jan-05 23:28
professionalV.27-Jan-05 23:28 
GeneralRe: Simple Calculator (Someone PLEASE HELP ME!!!!!) Pin
David Crow28-Jan-05 3:03
David Crow28-Jan-05 3:03 
GeneralRe: Simple Calculator (Someone PLEASE HELP ME!!!!!) Pin
David Crow28-Jan-05 3:02
David Crow28-Jan-05 3:02 
DHAPPREP wrote:
1. Define the class -- Calculator

a) Data members: Operand1, Operand2, and Answer -- all of type float.

b) Methods: Constructor, GetData, Add, Subtract, Multiply, Divide, and ShowAnswer -- all void return types.

c) Data members should be private, but all methods should be public


Here is a starting point:

class Calculator
{
public:
    Calculator( float Op1 = 0.0, float Op2 = 1.0 );
 
    void GetData();
    void Add();
    void Subtract();
    void Multiply();
    void Divide();
    void ShowAnswer( void );
 
private:
    float Operand1;
    float Operand2;
    float Answer;
};
DHAPPREP wrote:
5. Create four objects, Problem1, Problem2, Problem3, and Problem4 as follows:

Calculator Problem1(3,7), Problem2(8,3), Problem3, Problem4(17,5);


Since your class works with floating-point numbers, I think it would make sense to also test with floating-point numbers rather than just integers.

Calculator Problem1(17.2, 9.07), 
           Problem2(0.8, 3);

"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow


GeneralRe: Simple Calculator (Someone PLEASE HELP ME!!!!!) Pin
trelliot28-Jan-05 3:10
trelliot28-Jan-05 3:10 
GeneralWin32 EDIT Control Pin
Aneurysm0027-Jan-05 11:33
Aneurysm0027-Jan-05 11:33 
GeneralRe: Win32 EDIT Control Pin
Jim Crafton27-Jan-05 17:22
Jim Crafton27-Jan-05 17:22 
GeneralRe: Win32 EDIT Control Pin
Aneurysm0028-Jan-05 7:11
Aneurysm0028-Jan-05 7:11 
GeneralVS 7.1 On Windows XP Pin
Grahamfff27-Jan-05 10:57
Grahamfff27-Jan-05 10:57 
GeneralRe: VS 7.1 On Windows XP Pin
Christian Graus27-Jan-05 14:17
protectorChristian Graus27-Jan-05 14:17 
GeneralRe: VS 7.1 On Windows XP Pin
Jim Crafton27-Jan-05 17:10
Jim Crafton27-Jan-05 17:10 
GeneralRe: VS 7.1 On Windows XP Pin
rbid27-Jan-05 23:57
rbid27-Jan-05 23:57 
GeneralRe: VS 7.1 On Windows XP Pin
Grahamfff28-Jan-05 9:50
Grahamfff28-Jan-05 9:50 
Generalconvert double to char Pin
Sam197927-Jan-05 10:42
Sam197927-Jan-05 10:42 
GeneralRe: convert double to char Pin
Chris Losinger27-Jan-05 11:03
professionalChris Losinger27-Jan-05 11:03 
GeneralRe: convert double to char Pin
Jim Crafton27-Jan-05 17:07
Jim Crafton27-Jan-05 17:07 
GeneralRe: convert double to char Pin
trelliot27-Jan-05 13:16
trelliot27-Jan-05 13:16 
GeneralRe: convert double to char Pin
trelliot27-Jan-05 17:20
trelliot27-Jan-05 17:20 
GeneralRe: convert double to char Pin
JKallen27-Jan-05 17:32
JKallen27-Jan-05 17:32 
GeneralRe: convert double to char Pin
Mircea Puiu29-Jan-05 5:16
Mircea Puiu29-Jan-05 5:16 
QuestionIs a directory on local PC? Pin
Neville Franks27-Jan-05 10:34
Neville Franks27-Jan-05 10:34 

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.