Results 1 to 8 of 8

Thread: clrscr error

  1. #1

    Thread Starter
    Fanatic Member vivek_master146's Avatar
    Join Date
    Apr 2006
    Location
    Delhi,India
    Posts
    787

    Unhappy clrscr error

    Hi Visual c++ compier is giving the following error in compiling the code:

    #include <iostream.h>
    #include <conio.h>
    int main ()
    { clrscr();
    int d_o_w;
    cout<<"Enter num. of weeks(1-7):";
    cin>>d_o_w;
    switch(d_o_w)
    {
    case 1 : cout<<"\nsunday";
    break;
    case 2: cout<<"\nMonday";
    break;
    default:cout<<"wrong!";
    }
    return 0;

    }

    error:
    C:\Cpp1.cpp(4) : error C2065: 'clrscr' : undeclared identifier

  2. #2
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    266

    Re: clrscr error

    i think u need to include stdio.h file also ... well u can also search the forum u could find its solution

  3. #3
    Addicted Member SpS's Avatar
    Join Date
    Jul 2005
    Posts
    201

    Re: clrscr error

    Just remove conio.h and clrscr.
    #Appreciate others by rating good posts !!

    #The Software Peter Principle is in operation when unwise developers "improve" and "generalize" the software until they themselves can no longer understand it, then the project slowly dies.

    #People who are still ignorant of their ignorance are dangerous.

  4. #4

    Thread Starter
    Fanatic Member vivek_master146's Avatar
    Join Date
    Apr 2006
    Location
    Delhi,India
    Posts
    787

    Unhappy Re: clrscr error

    i know i had done exactly the same thing. Bu why clrscr is not wroking though it's given in thw book.

  5. #5
    Addicted Member SpS's Avatar
    Join Date
    Jul 2005
    Posts
    201

    Re: clrscr error

    It's a non-standard function. It is not supported by microsoft compilers.
    #Appreciate others by rating good posts !!

    #The Software Peter Principle is in operation when unwise developers "improve" and "generalize" the software until they themselves can no longer understand it, then the project slowly dies.

    #People who are still ignorant of their ignorance are dangerous.

  6. #6
    New Member
    Join Date
    May 2006
    Posts
    15

    Re: clrscr error

    Use

    Code:
    system("clrscr");

  7. #7
    Addicted Member SpS's Avatar
    Join Date
    Jul 2005
    Posts
    201

    Re: clrscr error

    Quote Originally Posted by JamesSchumacher
    Use

    Code:
    system("clrscr");

    That's not right. Use
    Code:
    system("cls");
    #Appreciate others by rating good posts !!

    #The Software Peter Principle is in operation when unwise developers "improve" and "generalize" the software until they themselves can no longer understand it, then the project slowly dies.

    #People who are still ignorant of their ignorance are dangerous.

  8. #8

    Thread Starter
    Fanatic Member vivek_master146's Avatar
    Join Date
    Apr 2006
    Location
    Delhi,India
    Posts
    787

    Re: clrscr error

    Thanks for help actually i m not c++ programmer i m a vb programmer. do u recommend me to learn c++ because of oop concepts. please reply
    Dont rely only on your luck. Work hard until You get success.
    vb Code:
    1. Private sub Time_ispassing
    2. While Me.Notgetsuccess
    3. trygain=tryagain+1
    4. Me.workhard
    5. wend
    6. end sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width