User Profile

Collapse

Profile Sidebar

Collapse
bryon
bryon
Last Activity: Apr 23 '10, 11:38 PM
Joined: Apr 6 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • bryon
    replied to How to get an array to sort
    in C
    ....... I am so freaking proud of myself right now!!!

    I got it to print the original and all I did was change line 45 from:
    Code:
    printf("%4d ", *pAry);
    To:
    Code:
    printf("%4d ", *pAry++);
    See more | Go to post

    Leave a comment:


  • bryon
    replied to How to get an array to sort
    in C
    So even if you put the printf state up further in your code before it all changes (like where I put it) it still wont orint the original?

    Look at lines 43-45


    Code:
    #include "stdafx.h"
    
    #define SIZE 4
    
    
    int* getData (int* pAry, int arySize);
    void selectSort (int* pAry, int* pLast);
    void printData (int* pAry, int* pLast);
    int* smallest (int* pAry, int*
    ...
    See more | Go to post

    Leave a comment:


  • bryon
    replied to How to get an array to sort
    in C
    THANK YOU SOOOO MUCH!!! now I just need it to print the numbers they originally put in...

    here is an example of what I get now that I can get id to print ascending and descending:

    lets say the numbers I put in are in this order: 4 7 12 1

    This is what i get

    Original: 4 4 4 4
    Ascending: 1 4 7 12
    Descending: 12 7 4 1

    See what I mean? I'm stuck on the original part now......
    See more | Go to post

    Leave a comment:


  • bryon
    replied to How to get an array to sort
    in C
    Ok this is what I have gotten to work so far (I did the first code completely wrong)... i want the results to look like this though.

    Original: (original order they entered the numbers in)
    Ascending: (from smallest to largest)
    Descending: (from largest to smallest)

    I got the Ascending part but don't know how to get the other 2.

    Code:
    #include "stdafx.h"
    
    #define SIZE 4
    ...
    See more | Go to post

    Leave a comment:


  • bryon
    replied to How to get an array to sort
    in C
    We are mainly working with arrays right now so I would not be allowed to use a strings. (not that I even know what a string is.....)

    Anyways, I haven't talked to him yet but as long as the program runs and does what its supposed to I doubt he will care what I do as long as I am working with arrays. I have done things that we haven't learned before and he didn't seem to mind cause he gave me a 100 and told me what a good job I did (which...
    See more | Go to post

    Leave a comment:


  • bryon
    replied to How to get an array to sort
    in C
    I have never heard of qsort before so I don't know if we can use that or not. He doesn't really care as long as we get it to do what the problem asked for. As for the algorithms. I don't see anything on algorithms in the chapter we are on. Right now we are learning about pointer applications and all it talks about is dynamic/static arrays and pointer arithmetic. This is an online class so we pretty much have to learn from the book which doesn't help...
    See more | Go to post

    Leave a comment:


  • bryon
    started a topic How to get an array to sort
    in C

    How to get an array to sort

    I have been trying to get an array to sort out 4 numbers that someone enters in. I have been reading on how to do this but nothing will work...

    This program is supposed to sort the numbers in ascending and descending order.

    This is what I have so far. I'm trying to get them to ascend right now but I'm failing.

    Code:
    #include "stdafx.h"
    
    #define ARY_SIZE 4
    
    int main(void)
    ...
    See more | Go to post

  • bryon
    replied to Help me with arrays.....
    in C
    I like the second one. I dont think I would lose points cause we learned about breaks but I just never used one before. The first one kind of confuses me.
    See more | Go to post

    Leave a comment:


  • bryon
    replied to Help me with arrays.....
    in C
    !!!!!!!!!!!!!!! !!! Some how I got it to work!! Its not the cleanest code ever but it works!! If you have any ideas on how you could of made it simpler or better ideas please tell me. I would like to learn how I could of made it easier on myself.


    Here is my code:

    [code=c]
    #include "stdafx.h"

    #define ARY_SIZE 10

    int main(void)
    {
    printf ("Welcome please enjoy...
    See more | Go to post

    Leave a comment:


  • bryon
    replied to Help me with arrays.....
    in C
    Ok I have gotten more down but now i'm having a problem creating a loop to return true or false if the elements match or not.

    [code=c]
    #include "stdafx.h"

    #define ARY_SIZE 3

    int main(void)
    {
    printf ("Welcome please enjoy this program.\n\n");

    int a [ARY_SIZE];
    int b [ARY_SIZE];

    printf ("Enter 10 numbers for array A.\n");
    ...
    See more | Go to post

    Leave a comment:


  • bryon
    replied to Help me with arrays.....
    in C
    well here is what I have so far... I just don't understand how you get them to compare to each other. I have read the chapter in my book over and over but it makes no sense to me.

    [code=c]
    #include "stdafx.h"

    #define ARY_SIZE 10

    int main(void)
    {
    printf ("Welcome please enjoy this program.\n\n");

    int a [ARY_SIZE];
    int b [ARY_SIZE];

    printf...
    See more | Go to post

    Leave a comment:


  • bryon
    started a topic Help me with arrays.....
    in C

    Help me with arrays.....

    I have a homework problem for my C programing class but I am so lost.....

    The question is:

    We have two arrays A and B, each of 10 integers. Write a function that tests if every element of array A is equal to its corresponding element in array B. In other words, the function must check if A[0] is equal to B[0], A[1] is equal to B[1], and so forth. The function is to return true if all elements are equal and false if at...
    See more | Go to post
No activity results to display
Show More
Working...