debugging code: plz debugg this code....

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

using namespace std;

class swapping;
cout << "Swapping value of two numbers \n";
int firstnumber, secondnumber;
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;
firstnumber= secondnumber;
secondnumber= x;
N1 = firstnumber;
N2 = secondnumber;
int main ()
swapping a;

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

return 0;


  • simplycoder
    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.

You are reading an archived discussion.

Related Posts

ME a STUDENT of SOFTWARE ENGINEERING, I want to develop an operating system as my FYP, i.e. 2 years later inshaallah. Any One please guide me to the steps to...
[h=2] c++ program[/h] can anybody write me a program on thoughtworks placement ques in c++ inventory control system.Two countries have inventory with 100 ipods in it. ipod is available in...
Steve Jobs has resigned from Apple as CEO. He's written a resignation letter to all the people in Apple community. The complete text of Steve's resignation letter is avaialble in...
Feels great to wish CEan-cd a very happy birthday! 🎉 Have a blast friend!
In a move to 'rebalance' the gender scales in office spaces, all the leading Indian Institutes Of Managements (IIMs) have decided to offer grace marks to girl candidates who apply...