Thread: Need help!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User snapshooter's Avatar
    Join Date
    Sep 2004
    Posts
    37

    Question Need help!

    Salut! i am a newbie in c++ programming and as a beginner i am in trouble.. i wrote a simple program in c++ for adding 2 numbers:
    Code:
    #include <iostream>
    
    int main()
    
      {
        
       int n1, n2, sum;
       sum  =  n1 + n2;
       cout << "Give the first number:" << endl;
       cin    >> n1;
       cout << "Give the second number:" << endl;
       cin    >> n2;
       cout  << "The result is...:" sum;
       
       return 0;
    
      }
    what's wrong with that code..? i am using Dev C++ v4 compiler.when i debug it, it show me no errors but when i execute it, first ask me for the 2 numbers and then terminated without the result..any help??
    Last edited by Salem; 09-27-2004 at 06:35 AM. Reason: Remember your code tags in future - read the "read before posting" post

Popular pages Recent additions subscribe to a feed