CrazyEngineers
  • plz debug this....i need it ...plzz help...



    #include
    using namespace std;

    class swapping;
    {
    cout << "Swapping value of two numbers \n";
    int firstnumber, secondnumber;
    public:
    void getdata (int N1, N2);
    void putdata (void);
    {
    cout << "firstnumber =" << firstnumber << "\n";
    cout << "secondnumber =" << secondnumber << "\n";
    }
    };
    void swapping :: getdata (int N1, N2)
    {
    int x=0;
    x=firstnumber;
    firstnumber= secondnumber;
    secondnumber= x;
    N1 = firstnumber;
    N2 = secondnumber;
    }
    int main ()
    {
    swapping a;

    cout << "\n object a " << "\n";
    a.getdata (23, 32);
    a.putdata();

    return 0;
    }
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • simplycoder

    MemberAug 24, 2011

    @#-Link-Snipped-#
    In computing just follow one principle: Keep It Simple and Straight(KISS).

    take the input in normal form using cin or scanf.
    print the data using printf or cout.

    learn the basic syntax and its other related stuff of whatever you thinking. In this case, you have messed up your function.
    You have complicated a simple program using all sort of operators, few are of them are not even required here, one of them is the scope-operator.

    Please format your code so it is easier to read.
    Use indentations and comments. They will make things clear to us so that we can help you better.

    Now by viewing your code, I am quiet sure you dont know how to program in C++.
    Make sure you right some procedural or structural programs before you go for OOP.
    Learn the basic syntax that is the most important thing, in any language.

    Understand meaning of each thing that you code, the inventer of C++ is highly intelligent and skilled, so he never programed anything redundant, make sure you dont add redundant things.

    Take a look where you have class declared, where you have coded for cout and so on. Get the syntax corrected first.
    There are many syntax errors in your code, eliminate all of the first.

    If you can clear all the syntax problems, and still have logical problems, I think then only CEans might be able to help you in real sense.
    Just fixing your code, it wont help you much.

    In long run, debugging your own code will make you better,faster and efficient programmer.
    In next posting, please use code-tags.
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register