Results 1 to 7 of 7

Thread: Need help C

  1. #1
    Join Date
    Dec 2004
    Posts
    476
    Rep Power
    0

    Angry Need help C

    // Find average temperature
    #include <stdio.h>

    int main()
    {


    int max, min, average = 0;

    printf("enter maximum temperature:/ln");
    scanf("%d ,&max);
    printf("enter minimum temperature:/ln");
    scanf("%d ,&min);
    average = (max+min)/2
    print(average temperature,%d and %d is %d\n", max,min,average);
    return 0;

    }

    it written in C and im getting errors can someone help me
    WHY PAY WHEN YOU CAN GET IT FREE!!!!!

  2. #2
    Join Date
    Oct 2004
    Posts
    4,814
    Rep Power
    24

    Default

    what errors are u getting?

  3. #3
    Join Date
    Dec 2004
    Posts
    476
    Rep Power
    0

    Default

    --------------------Configuration: Cpp1 - Win32 Debug--------------------
    Compiling...
    Cpp1.cpp
    C:\Documents and Settings\Perferred Customer\Desktop\Cpp1.cpp(12) : error C2001: newline in constant
    C:\Documents and Settings\Perferred Customer\Desktop\Cpp1.cpp(13) : error C2146: syntax error : missing ')' before identifier 'printf'
    C:\Documents and Settings\Perferred Customer\Desktop\Cpp1.cpp(14) : error C2001: newline in constant
    C:\Documents and Settings\Perferred Customer\Desktop\Cpp1.cpp(15) : error C2146: syntax error : missing ')' before identifier 'average'
    C:\Documents and Settings\Perferred Customer\Desktop\Cpp1.cpp(16) : error C2017: illegal escape sequence
    C:\Documents and Settings\Perferred Customer\Desktop\Cpp1.cpp(16) : error C2001: newline in constant
    C:\Documents and Settings\Perferred Customer\Desktop\Cpp1.cpp(19) : error C2143: syntax error : missing ')' before '}'
    C:\Documents and Settings\Perferred Customer\Desktop\Cpp1.cpp(19) : error C2143: syntax error : missing ';' before ')'
    C:\Documents and Settings\Perferred Customer\Desktop\Cpp1.cpp(19) : warning C4508: 'main' : function should return a value; 'void' return type assumed
    Error executing cl.exe.

    Cpp1.obj - 8 error(s), 1 warning(s)
    WHY PAY WHEN YOU CAN GET IT FREE!!!!!

  4. #4
    Join Date
    Oct 2004
    Posts
    4,814
    Rep Power
    24

    Default

    quote the print string properly and add in the ; where its needed.

    int main()
    {


    int max, min, average = 0;

    printf("enter maximum temperature:/ln");
    scanf("%d" ,&max);
    printf("enter minimum temperature:/ln");
    scanf("%d" ,&min);
    average = (max+min)/2;
    print("average temperature,%d and %d is %d\n", max,min,average);
    return 0;

    }

  5. #5
    Join Date
    Aug 2005
    Posts
    486
    Rep Power
    0

    Default

    Dont forget to reinset the header file.
    Need more information? Send a PM or Email Me @ Ralphsteinhibbert@gmail.com--- You can also call me @ 377 - 5710 (no privated numbers).
    Quote Originally Posted by Bawn_Jamaican View Post
    Click the blue arrow to see me

  6. #6
    Join Date
    Jun 2003
    Posts
    453
    Rep Power
    0

    Default

    yea dem lil error deh love hide. sometimes it takes another pair of eyes to spot them . Leo has it down pat akoo so just make the corrections\additions and u good to gizzle.
    We Is Friends!
    Me And You Is Friends!
    You Smile, I Smile ....
    You Hurt, I Hurt ..
    You Cry, I Cry ..
    You Jump Off A Bridge ..
    I Gonna Miss Your E-Mails !

  7. #7
    Join Date
    Feb 2006
    Posts
    12
    Rep Power
    0

    Default

    well from here u forgot the "F" in printf the last one

Posting Permissions

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