Search:

Type: Posts; User: bigparker

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    7
    Views
    3,107

    say if N was 10, the outside loop would run 5...

    say if N was 10, the outside loop would run 5 times, and the inside loop would also run 5 times, so would it be O(5N)?
  2. Replies
    7
    Views
    3,107

    Big O Notation

    I have some code snippets in which I have to find the run time using big O notation.


    code frag 1:


    void E(int array[], int N){
    int i, j;
    for(i=1; i<N-5; i++){
  3. Replies
    6
    Views
    2,577

    oh ok...i understand. thanks guys, that helped me...

    oh ok...i understand. thanks guys, that helped me out alot...its compiling fine now.
  4. Replies
    6
    Views
    2,577

    line 21 is at "int main(){}" line 46 is "void...

    line 21 is at "int main(){}"
    line 46 is "void swap(int *, int, int)"


    and those are double pointers because I thought since my dynamic array was already a pointer, I needed a pointer to the...
  5. Replies
    6
    Views
    2,577

    Help with error

    When compiling I get these errors:

    sort.c:21error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âintâ
    sort.c:46: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â{â to ...
  6. Replies
    14
    Views
    2,235

    oh ok i attempted to use this while((j =...

    oh ok i attempted to use this



    while((j = fscanf(pfile, "%d", &num)) !=EOF){
    data_in[i] = num;
    i++;
    }
  7. Replies
    14
    Views
    2,235

    oh ok...I got that straight...it was because I...

    oh ok...I got that straight...it was because I had MAX set to a value greater than the number of integers in my input file...
  8. Replies
    14
    Views
    2,235

    thanks...that got rid of the seg fault. Do you...

    thanks...that got rid of the seg fault. Do you guys have any idea of why the the program would only print the last value in my input file? its prints 421 repeatedly...



    # define MAX 1000...
  9. Replies
    14
    Views
    2,235

    Not to seem basic, but how do i test to be sure...

    Not to seem basic, but how do i test to be sure that i dont run past the end of my buffer?
  10. Replies
    14
    Views
    2,235

    int main(){ printf("Cake"); int data_in[100];...

    int main(){
    printf("Cake");
    int data_in[100];
    FILE *pfile;
    pfile = fopen("input.txt", "r");
    int i=0;

    int num=0;

    do{
  11. Replies
    14
    Views
    2,235

    int main(){ printf("Cake"); int data_in[100];...

    int main(){
    printf("Cake");
    int data_in[100];
    FILE *pfile;
    pfile = fopen("input.txt", "r");
    int i=0;
    int k=0;
    int num=0;

    do{
  12. Replies
    14
    Views
    2,235

    I have no other function in the program. I broke...

    I have no other function in the program. I broke up all of my declarations and initialized all the variables to zero, but the seg fault is still there...
  13. Replies
    14
    Views
    2,235

    Segmentation Fault

    Can someone help me figure out why I am getting a seg fault at run time...





    #include <stdio.h>
    #include <stdlib.h>
  14. thanks...i got it this part figured out using the...

    thanks...i got it this part figured out using the strcpy...it ended up looking like this...



    while((i=fscanf(fp,"%10s %i %i %f", name, &lattitude, &longitude,&force))!=EOF){


    ...
  15. alright its seems to make more sense so I tried...

    alright its seems to make more sense so I tried this:



    /*This reads from the input file, and store the data into the array of structs*/

    while((i=fscanf(fp2,"%10s %i %i %f", name, &lattitude,...
  16. yeah...im still having some trouble with this...

    yeah...im still having some trouble with this strcpy. I guess I need to do some more reading on how to use it, and then figure how to implement it with the struct...
  17. lol...there was one for a minute, i was trying to...

    lol...there was one for a minute, i was trying to figure out how to use strcpy to copy the input to my struct. But im drawing blanks..here is what I have so far...



    for(g=0;g<1000; g++){...
  18. oh thx. Is there a different way that we must...

    oh thx. Is there a different way that we must handle char, and strings? the integers are fine, but when I attempt to store the "char name" with:


    ...
  19. I want to assign the values that were read in...

    I want to assign the values that were read in from the input file and store them into the array of structs. If my input was:

    Alberto 80 8 42.720000
    ...
  20. ok...Ive changed it up. But when it comes to...

    ok...Ive changed it up. But when it comes to copying the scanned values into the structure, I'm having some trouble with the syntax.


    int j=0;
    while((i=fscanf(fp2,"%10s %i %i %f", &name,...
  21. Storing Info From file into Array of structs

    Hello,

    I have started to write a program that uses structs, however I am unsure of how to get the data correctly into the array of structs. This is what I Have so far...



    #include <stdio.h>...
  22. Replies
    21
    Views
    7,539

    thank you guys sooo much!! I appreciate the tough...

    thank you guys sooo much!! I appreciate the tough love. It made me dig deeper than I thought I could...My program works fine now...
  23. Replies
    21
    Views
    7,539

    yes...I assumed if i casted the value as a float...

    yes...I assumed if i casted the value as a float then it would give me the numeric values after the decimalpoint . But even with the cast if the mean is 3.5 it prints 3 and if sigma is 1.73 its...
  24. Replies
    21
    Views
    7,539

    i understand how things work here now. i fixed...

    i understand how things work here now. i fixed the things that you guys suggested and im getting values now. no more nan outputs. The only thing now is that even though I have specified that the...
  25. Replies
    21
    Views
    7,539

    Thanks for all your help. I guess I came to the...

    Thanks for all your help. I guess I came to the wrong place. Im new to C and pretty much a novice in programming period. I'm not looking for you guys to write my program for me. I'm simply stating...
Results 1 to 25 of 28
Page 1 of 2 1 2