Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 36
  1. #11

    heheh!!. sorry... i'll just show you my code and... just help me where are my mistakes..
    thanks again.. and sorry for the trouble...

    #include <stdio.h>
    #define N 7
    void input (float a[], int N);
    float highest (float a[], int N);
    float lowest (float a[], int N);
    float average (float highest, float lowest, float a[], int N);

    int main (void)
    {
    float a[N];
    float Highest, Lowest, Average;

    input (a[], N);
    Highest = highest (a[], N);
    Lowest = lowest (a[], N);
    Average = average (Highest, Lowest, a[], N);
    printf ("Highest : %.2f", Highest);
    printf ("Lowest : %.2f", Lowest);
    printf ("Average : %.2f", average);

    }

    void input (float a[], int N)
    {
    int i;
    prinf("Enter the scores of 7 judges:");
    for (1=0; i<N; i++)
    scanf ("%f", &a[i]);
    }

    float highest (float a[], int N)
    {
    int i;
    float highest;
    highest=a[o];
    for (i=1; i<n; i++)
    if (highest<a[i])
    highest=a[i];

    return highest;
    }

    float lowest (float a[], int N)
    {
    int i;
    float lowest;
    lowest=a[0];
    for (i=1; i<N; i++)
    if (lowest>a[i])
    lowest = a[i];

    return lowest;
    }

    float average (float highest, float lowest, float a[], int N)
    {
    int i;
    float highlow, ave, x;
    highlow = highest + lowest;
    for (i=0; i<N; i++)
    sum = sum + a[i];
    x = sum - highlow;
    ave = x/5.0;

    return ave;
    }

    ps: i've minimized the errors in my code
    please HELP me on this i need it working ASAP!..

    Error C:\tc2\projecti.c 3: Declaration syntax error
    Error C:\tc2\projecti.c 4: Declaration syntax error
    Error C:\tc2\projecti.c 5: Declaration syntax error
    Error C:\tc2\projecti.c 6: Declaration syntax error
    Error C:\tc2\projecti.c 13: Expression syntax in function main
    Error C:\tc2\projecti.c 14: Expression syntax in function main
    Error C:\tc2\projecti.c 15: Expression syntax in function main
    Error C:\tc2\projecti.c 16: Expression syntax in function main
    Warning C:\tc2\projecti.c 17: posible use of 'Higest' before definition in function main
    Warning C:\tc2\projecti.c 18: posible use of 'Lowest' before definition in function main
    Error C:\tc2\projecti.c 23: Declaration syntax error

  2. #12
    input (a, N);
    Highest = highest (a, N);
    Lowest = lowest (a, N);
    Average = average (Highest, Lowest, a, N);

    mao man basin na. hahaaha

  3. #13
    I'm not too sure about the logic but here goes. I've removed all your errors about N and n. Something like o and 0. I'm not practicing C++ by profession so I'm not sure about what you did in school but using Turbo C is quite old. Visual C++ 2003 and up is complaint to standard 99. Or better yet the GNU Compilers are good.

    There is also an upcoming standard for C++ by ANSI (I think) this coming 2009. I just don't know the details. Anyway, here's your code. And oh, please use [code][/code] when posting code.

    Code:
    #include <stdio.h>
    #define N 7
    
    void input(float a[], int n) {
    	printf("Enter the scores of 7 judges: ");
    	for (int i = 0; i < n; i++) {
    		scanf("%f", &a[i]);
    	}
    }
    
    float highest (float a[], int n) {
    	int i;
    	float highest;
    	highest=a[0];
    	for (i=1; i<n; i++)
    	if (highest<a[i])
    	highest=a[i];
    
    	return highest;
    }
    
    float lowest (float a[], int n) {
    	int i;
    	float lowest;
    	lowest=a[0];
    	for (i=1; i<n; i++)
    	if (lowest>a[i])
    	lowest = a[i];
    
    	return lowest;
    }
    
    float average (float highest, float lowest, float a[], int n) {
    	int i;
    	float highlow, ave, x, sum = 0;
    	highlow = highest + lowest;
    	for (i=0; i<n; i++)
    	sum = sum + a[i];
    	x = sum - highlow;
    	ave = x/5.0;
    
    	return ave;
    }
    
    int main() {
    	float a[N];
    	float Highest, Lowest, Average;
    
    	input (a, N);
    	Highest = highest (a, N);
    	Lowest = lowest (a, N);
    	Average = average (Highest, Lowest, a, N);
    
    	printf ("Highest : %.2f", Highest);
    	printf ("Lowest : %.2f", Lowest);
    	printf ("Average : %.2f", Average);
    
    	return 0;
    }
    There are still warnings though and I don't bother solving them. I used VC2005 so you might want to convert it if anything goes wrong with Turbo C.

    Best Regards!

  4. #14
    so you can make a program in this manner......
    quite confussed on the arrangement.. *heheheh* but it's ok..
    thanks for the correction... hehehe compiling it now.....


    one more thing.... how about the prototype?> is it ok not to place a function prototype??..

  5. #15
    Quote Originally Posted by pau_liniment View Post
    so you can make a program in this manner......
    quite confussed on the arrangement.. *heheheh* but it's ok..
    thanks for the correction... hehehe compiling it now.....


    one more thing.... how about the prototype?> is it ok not to place a function prototype??..
    Yes it is. As a small code, you don't actually do prototyping.

  6. #16
    I guess the thread starter wanted us to reply with our email address not with the code. . .

  7. #17
    Quote Originally Posted by pau_liniment View Post
    so you can make a program in this manner......
    quite confussed on the arrangement.. *heheheh* but it's ok..
    thanks for the correction... hehehe compiling it now.....


    one more thing.... how about the prototype?> is it ok not to place a function prototype??..
    you dont need prototype if your function is above your main

  8. #18
    you dont need to put the prototype if your other functions are above your main function..

  9. #19
    hala ba nmu choi.... dapat pa ba ni ipangutana damn this is first grade..... kamao man kaha ka ug math?? gamita imo utuk... ayaw gamita amoang utuk.... saun pa kaau na choi... tan-awa lang inig abot nmu sa data structures ug algorithms kay mka ubo jud imo utuk... kanang mga TREES, HASHING, LISTS, ETC... kung d ka mka solve ani ug imoha lang... mypa mag nursing nlng ka... hahahah.... btaw for beginners mas nindot jd kung mag suwat sa ka ug psuedocode or flow chart sa imong program... kanang step by step na buhaton ba in details jd para dali nlng inig code... TIP lang bai.... "THINK OUTSIDE THE BOX... NOT INSIDE THE BOX... NOR THE BOX ITSELF...." ayaw pag huna2x kung unsa ang ghatag nmu... huna2x ang unsay wala ghatag nmu sa imo teacher... ayaw sad pag cgeg huna2x sa imong g-huna2x na problema pirmi lihok sad panagsa ug imo... peace bro...

  10. #20
    Come on guys! It's a simple question. And somebody is needing it. And yet you do nothing about it. Instead, you just keep on saying "Think outside the box, or keep thinking..." Come on! Tell me, who in the world is not trying to think outside the box? Who in the world is not trying to think?

    Ka remember ko sa ako maestro sa una saying "Pa kopyaha imong tapad, unsaon man nya ug kahibawo kung dili nimo pa kopyahon..." Well it's a good statement. A true statement.

    Saying about data structures and design patterns and best practices. And oh, new programming languages.. What's in, application framework. MVC models. Come on!!!! If you're in business applications, tell me, did you ever use binary trees? Did you ever use memory management using memory allocation for objects you're using? Did you ever get to know Java better? Did you ever get to build another programming language? Guys, it's just help we are talking here. That's the reason of this forum. Please do tell me if it's not!

    Honestly, we use MVC or some presenter/model pattern for business apps. And some design patterns too. But that's it. We never bother digging algorithms just to get data from the database and store in the memory in an effective way, for example. So there might be things you need to learn aside from the teacher telling you shit. Binary trees? Hashing? Ask your teacher if what's the weight of the things she/he is teaching you.

    But of course, it has some use. Besides, these things are everywhere. You don't create your algo now a days. Reuse it! That's the reason we don't have our teacher's names on this kind of book. Teachers rarely go to the real world coding.

    This is one good example of a kid learning. He asked. And what you guys did? Flame the thread. We are IT here. We're professionals. We are no gangsters. Unless, of course, if you're playing smart.

    Of course I'm not. I'm just being practical. If you think your subjects don't suit your needs, cut it. Just be sure you pass!

  11.    Advertisement

Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

 
  1. to all people out there!
    By khaye in forum Computer Hardware
    Replies: 6
    Last Post: 01-01-2013, 02:25 PM
  2. Replies: 13
    Last Post: 04-05-2011, 11:51 AM
  3. To all guys out there!!
    By jhellie_baby in forum Relationships (Old)
    Replies: 9
    Last Post: 10-14-2009, 05:12 PM
  4. To All Engineers Out There..need your help.
    By jcuizon in forum General Discussions
    Replies: 0
    Last Post: 10-11-2009, 08:26 PM
  5. to all programmers out there... I NEED HELP XD
    By pau_liniment in forum General Discussions
    Replies: 0
    Last Post: 08-30-2008, 09:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top