error

This is a discussion on error within the C Programming forums, part of the General Programming Boards category; 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 > ...

  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
    21,593
    *thread closed*

    Use the thread in the C++ forum instead.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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, 10:48 AM
  3. Replies: 4
    Last Post: 07-24-2011, 09:38 PM
  4. Replies: 1
    Last Post: 11-15-2010, 10:14 AM
  5. Replies: 3
    Last Post: 10-02-2007, 09:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21