Hello,
We just started studying classes right now, we are studying classes. Unfortunately, my teacher is not very helpful.
I was given a study guide for my midterm and one of the questions there was to create a half adder. I already did the .h part and i believe it is correct. However, I have not done the two .cpp aspects. I don't know what a half adder is because i just started studying gates and have not done half adder yet.
I have posted the .h i.e the header aspect of the class. However, I need help as to write the driver .cpp and the other .cpp. Please help me cos this is the toughest question in the study guide. thank you.

#pragma once

#using <mscorlib.dll>

using namespace System;

class Complex
{
private:
    bool sum;
    bool carry;

public:
    HalfAdder();
    HalfAdder(double, double);
    set_HalfAdder(bool, bool);
    get_HalfAdder();
    
};

P.s> i think i am expected to initialize the data members to 0. the purpose of the program is to demonstrate the above functions i.e the set_half adder and the get_half adder functions.

Recommended Answers

All 3 Replies

>>I don't know what a half adder
Neither do I. It must have been explained in class or in your textbook.


>>I need help as to write the driver .cpp and the other .cpp
Yes we will be glad to help you when you post the code you have written.

I think the variables you declared on lines 10 and 11 should be double, not bool. bool is for yes and no (1 and 0).

This brings back memories for me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.