Thread: error

  1. #1
    Registered User
    Join Date
    Feb 2013
    Posts
    5

    Unhappy error

    Code:
    #include<conio.h>
    #include<iostream.h>
    class lrsn
    {
       int n,l,s,i;
       public:
       void check()
    {
       cout<<"enter a no";
       cin>>n;
       l=0;
       s=n;
       while(n > 0)
    {
       if(n>=l)
       l=n;
       else if(n<l)
       s=n;
       cout<<"enter a no";
       cin>>s;
    }
    };
      void main();
    {
      lrsn a;
      clrscr();
      a.check();
      getch();
    }
    here i am getting error..
    "declaration terminated incorrectly"

  2. #2
    Stoned Witch Barney McGrew's Avatar
    Join Date
    Oct 2012
    Location
    astaylea
    Posts
    420
    What do you call this language?

  3. #3
    Registered User
    Join Date
    Feb 2013
    Posts
    5
    C++ language

  4. #4
    Stoned Witch Barney McGrew's Avatar
    Join Date
    Oct 2012
    Location
    astaylea
    Posts
    420
    Oh. Why not post it on the C++ sub-forum?

  5. #5
    Registered User
    Join Date
    Feb 2013
    Posts
    5
    i m new here.. dnt have idea how to post n all..but want answer fastly..thats y i postd here.

  6. #6
    Stoned Witch Barney McGrew's Avatar
    Join Date
    Oct 2012
    Location
    astaylea
    Posts
    420
    Well, people who frequent this sub-forum are likely to be more familiar with C than C++, myself included. I don't really understand how you're meant to layout those weird 'class' things, but the fact that your source code has four opening braces and three closing braces seems to be the problem (or at least one of the problems). Double-check your braces.

  7. #7
    Registered User
    Join Date
    Feb 2013
    Posts
    5
    yeah..thanx

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    *thread closed*

    Use the thread in the C++ forum instead.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 10-29-2012, 03:33 AM
  2. Replies: 15
    Last Post: 11-28-2011, 11:48 AM
  3. Replies: 4
    Last Post: 07-24-2011, 09:38 PM
  4. Replies: 1
    Last Post: 11-15-2010, 11:14 AM
  5. Replies: 3
    Last Post: 10-02-2007, 09:12 PM