Like Tree2Likes
  • 2 Post By Elkvis

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();
    }
    i m getting error:
    declaration terminated incorreclty

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,772
    Indent your properly code, and don't use void main. You will see your error.
    Also, instead of getch, read how to pause your console properly.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Feb 2013
    Posts
    22
    Please give more information. What does the program do?

  4. #4
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,651
    Code:
    void main();
    should be
    Code:
    int main()
    Note well the lack of a semicolon.

  5. #5
    Registered User
    Join Date
    Oct 2006
    Posts
    2,494
    I suspect that turbo C++ is in use here, because of the iostream.h. ditch that crap and use a real compiler that was made in the last 10 years.
    Salem and Elysia like this.

  6. #6
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,772
    Oh, crap. How could I have missed that?
    Anyway, here are some real (aka modern) IDEs: SourceForge.net: Integrated Development Environment - cpwiki
    Good compilers include Visual C++ (included in the Visual Studio IDE), gcc (mingw for windows) and clang.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

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