Problem Concerning C Lang

Hello s
I started learning C programming a month or two ago.
I tried to use the clrscr(); fuction in the program
i have included conio.n and stdio.h , but the compiler i use throws up "Undefined reference to clrscr()" error while compiling. Anyone know why? I googled ( as i usually do when i meet with a problem) but nothing..
I am using the latest version of Code::Blocks
- Thanks Sam 😁

Replies

  • Manish Goyal
    Manish Goyal
    it is conio.h not conio.n
  • sam_from_hell
    sam_from_hell
    sorry typo
    *i included conio.h 😁
  • Manish Goyal
    Manish Goyal
    can you post your program and which compiler are you using?
  • sam_from_hell
    sam_from_hell
    This is a small program i learnt to compare two strings using strcmp()..
    I use CodeBlocks, and the GNU GCC compiler.




    #include
    #include
    #include
    int main (void)
    {
         char password[11]= {"qwerty"};
         char inputpassword[11]= "";
         char newpassword[11]="";
         char response[2]="";
         char responsey[2]="Y";
         char responsen[2]="N";
         int i=0;
         while (i<10)
         {
             printf("Enter Password :\n");
             gets(inputpassword);
             if (strcmp(password,inputpassword)==0)
                {
                   printf("Do u want to change password?[Y/N]:\n");
                   scanf("%s",response);
                   if (strcmpi(responsey,response)==0)
                      {
                          printf("Enter new password:\n");
                          scanf("%s", password);
                          printf("The new password is: %s\n", password);
                      }
                   else
                      {
                          printf("Welcome:\n");
                      }
                }
             else
                 {
                   //clrscr();
                   printf("Invalid Password\n");
                 }
             i++;
         }
         getch();
    }
    
  • anandkumarjha
    anandkumarjha
    #include
    #include
    #include
    int main (void)
    {
    char password[11]= {"qwerty"};
    char inputpassword[11]= "";
    char newpassword[11]="";
    char response[2]="";
    char responsey[2]="Y";
    char responsen[2]="N";
    int i=0;
    while (i<10)
    {
    printf("Enter Password :\n");
    gets(inputpassword);
    if (strcmp(password,inputpassword)==0)
    {
    printf("Do u want to change password?[Y/N]:\n");
    scanf("%s",response);
    if (strcmp(responsey,response)==0)
    {
    printf("Enter new password:\n");
    scanf("%s", password);
    printf("The new password is: %s\n", password);
    }
    else
    {
    printf("Welcome:\n");
    }
    }
    else
    {
    //clrscr();
    printf("Invalid Password\n");
    }
    i++;
    }
    getch();
    }
    Try this code
  • Manish Goyal
    Manish Goyal
    if you using gnu gcc compiler then conio.h will not work

    and also you have to include file as

    include
  • sam_from_hell
    sam_from_hell
    goyal420
    if you using gnu gcc compiler then conio.h will not work

    and also you have to include file as

    include
    ok thanks, i will check it out 😁
  • sam_from_hell
    sam_from_hell
    goyal420
    if you using gnu gcc compiler then conio.h will not work

    and also you have to include file as

    include
    GNU GCC does support conio.h..
    the solution for the problem i originally posted is to use a user defined function that can be found here instead of clrscr(); ( u can create a header file from the code given in the end of the link)
    https://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1031963460&id=1043284385
    (found this after asking 3 people lol 😁 )
    also you cant use "include " for some reason(maybe because i'm using c and not c++)
    it HAS to be #inlcude
    --Thanks Sam 😁

You are reading an archived discussion.

Related Posts

AVAYA is introducing a new 11.5" tablet that it says will kill the polycom in cubicles and conference rooms in corporate offices. The tablet, apart from being a tablet acts...
Martin King, the co-creator of software that lets you type rapidly on your mobile phone while guessing your words, died last week after a long fight with cancer. "It leaves...
Q1. How capaitor acts as a filter ?(reason behind its action) Q2. Why capacitors with high capacitance are used at power rails and the one with low capacitance at power...
CEans, Dileep joined CrazyEngineers on 6th August 2009. With over 500 posts, he’s one of the most active CEans on CrazyEngineers. A crazy electrical engineer, CEan Dileep has recently shown...
hi guys i am doing the experiment 'study of pll'-finding its lock range and capture range (free running frequency is 2.5khz) can anyone clearly explain me how to find fc1,fl2,fc2,fl1...