what is wrong

Discussion in 'Programmer's Corner' started by mkbutan, Feb 9, 2012.

  1. mkbutan

    Thread Starter Senior Member

    Sep 30, 2008
    270
    16
    hi
    i am learning 'C' language and using the DEV C++ compiler but its giving some errors i cant understand how to fix it / what i did wrong or i have to use TC (i don't know what this program is its in our institute ) pl. help
    thanks in advance.

    the program is as follows :-

    /*
    Name: M.K.Butan
    Copyright:
    Author:
    Date: 09/02/12 14:15
    Description:
    */
    #include<stdio>
    #include<conio>
    void main()
    {
    int a,b;
    int add,sub,mul,div;
    printf("\n Enter the Number :");
    scanf("%d%d",&a&b);
    add=a+b;
    sub=a-b;
    mul=a*b
    div=a/b;
    printf("add is :%d",sum);
    printf("\n sub is :%d",sub);
    printf("\n mul is :%d",mul);
    printf("\n div is :%d",div);
    getch();
    }
     
    • 1.jpg
      1.jpg
      File size:
      132.2 KB
      Views:
      18
    • 2.jpg
      2.jpg
      File size:
      135.6 KB
      Views:
      13
  2. mkbutan

    Thread Starter Senior Member

    Sep 30, 2008
    270
    16
    ok i have removed he name


    /*
    Name: M.K.Butan
    Copyright:
    Author:
    Date: 09/02/12 14:15
    Description:
    */




    #include<stdio.h>.h was missing
    #include<conio.h>.h was missing
    void main()
    {
    int a,b;
    int add,sub,mul,div;
    printf("\n Enter the Number :");
    scanf("%d%d",&a&b);
    add=a+b;
    sub=a-b;
    mul=a*b;; was missing
    div=a/b;
    printf("add is :%d",sum);
    printf("\n sub is :%d",sub);
    printf("\n mul is :%d",mul);
    printf("\n div is :%d",div);
    getch();
    }
     
  3. mkbutan

    Thread Starter Senior Member

    Sep 30, 2008
    270
    16
    but what is this for
    /*
    Name: M.K.Butan
    Copyright:
    Author:
    Date: 09/02/12 14:15
    Description:
    */
     
  4. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    anything between /* and */ is a comment
    antything after // till the end of line is a comment
     
    mkbutan likes this.
  5. codehead

    Member

    Nov 28, 2011
    56
    11
    Ouch. Looks like you need to spend a little more time "learning 'C' language"...

    Anyway, your error messages are pretty clear—the compiler can't find the header files. Can you? If you can, then find out how you need to tell the compiler where they are (hint: it involves file paths). But you need to do some reading first.
     
    mkbutan likes this.
  6. MrChips

    Moderator

    Oct 2, 2009
    12,446
    3,362
    Your statements:

    #include<stdio>
    #include<conio>

    should read:

    #include<stdio.h>
    #include<conio.h>
     
    mkbutan likes this.
  7. mkbutan

    Thread Starter Senior Member

    Sep 30, 2008
    270
    16



    sir i have just attended two classes for the 'c'
     
  8. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,014
    That no where near does that do it. You are barely getting started. Study, study, study.

    Look at examples. Give yourself homework of very simple programs and build from there. Don't try to write the big program first thing.
     
    mkbutan likes this.
  9. mkbutan

    Thread Starter Senior Member

    Sep 30, 2008
    270
    16
    whats wrong in these TWO program?
    Ist on is for the Calculation of Salary ; and the IInd on is for the Conversion of TEMP. F to C
    pl help

    First

    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    float basic,da,hra,salary;
    printf("\n Enter the Basic Salary :");
    scanf("%f",&basic);
    da=basic*40/100;
    hra=basic*20/100;
    salary=basic+da+hra;
    printf("\n The Basic Salary is :%f",basic);
    prinrf("\n The DA is : %f",da);
    prinrf("\n The HRA is : %f",hra);
    prinrf("\n The Total Salary is : %f",salary);
    getch();
    }


    Second

    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    float f,c;
    printf("\n Enter the TEMP. in F :");
    scanf("%f%f",&f,&c);
    c=5/9.0*(f-32);
    printf("\n The TEMP. in F : %f",f);
    prinrf("\n the TEMP. in C : %f",c);
    getch();
    }
     
  10. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    Can´t you just read each error and correct it? And maybe google something about it?
     
    mkbutan likes this.
  11. MrChips

    Moderator

    Oct 2, 2009
    12,446
    3,362
    You have spelling errors. prinrf should be printf.
     
    mkbutan likes this.
  12. mkbutan

    Thread Starter Senior Member

    Sep 30, 2008
    270
    16



    thanks but its printf only
     
  13. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,014
    But that is what you posted.
     
    mkbutan likes this.
  14. mkbutan

    Thread Starter Senior Member

    Sep 30, 2008
    270
    16


    First

    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    float basic,da,hra,salary;
    printf("\n Enter the Basic Salary :");
    scanf("%f",&basic);
    da=basic*40/100;
    hra=basic*20/100;
    salary=basic+da+hra;
    printf("\n The Basic Salary is :%f",basic);
    prinrf("\n The DA is : %f",da);
    prinrf("\n The HRA is : %f",hra);
    prinrf("\n The Total Salary is : %f",salary); (yes you are right it was not printf))
    getch();
    }


    Second

    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    float f,c;
    printf("\n Enter the TEMP. in F :");
    scanf("%f%f",&f,&c);
    c=5/9.0*(f-32);
    printf("\n The TEMP. in F : %f",f);
    prinrf("\n the TEMP. in C : %f",c); (yes you are right it was not printf))
    getch();
    }




    thanks
    thanks
    thanks
     
    Last edited: Feb 11, 2012
  15. codehead

    Member

    Nov 28, 2011
    56
    11
    (To my comment, Ouch. Looks like you need to spend a little more time "learning 'C' language"...)

    Sorry, I wasn't trying to be insulting—I just meant that you need to study a little more before expecting results and asking questions. Comments are one of the very first things taught in any discussion of C or other languages. So, it was obvious that you copied some code from somewhere and modified a little maybe without understanding it. You need to do a little reading first, then try to make something that you think you understand compile. There are so many online resources that teach C from scratch—teach you how to build and compile a "hello world" program, then start adding things.
     
    mkbutan likes this.
  16. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,809
    834
    Is this what you intended? "printrf" versus "printf"? "prinrf" is incorrect...
     
    mkbutan likes this.
Loading...