Search:

Type: Posts; User: spydoor

Page 1 of 6 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    214
    Views
    20,394

    probably due to a buffer overrun. You only allow...

    probably due to a buffer overrun. You only allow the storage of 11 characters for each town name, but Bournemouth requries 12. 11 plus a null character.

    Since there is no null stored at the end of...
  2. Replies
    6
    Views
    1,065

    You probably just need another getchar() at the...

    You probably just need another getchar() at the end to "keep the window open"

    Since you have a leftover new line from your second scanf now
  3. Replies
    6
    Views
    1,065

    tot is a double so you should be using %lf in...

    tot is a double so you should be using %lf in your scanf

    scanf("%lf",&tot);


    there is a newline character left over in the input buffer after entering a total, so tea is likely getting set to...
  4. Replies
    14
    Views
    24,221

    Looks like you need to allocate some space for...

    Looks like you need to allocate some space for *myregex.

    Also, need to escape your backslashes in the expression

    "^ *[-+]?([0-9]+(\\.[0-9]*)?|\\.[0-9]+)([eE][-+]?[0-9]+)? *$",
  5. Replies
    11
    Views
    1,643

    You set y to the strlen of key before key is...

    You set y to the strlen of key before key is initialized.
    You should do this after gets. (you should also use fgets instead of gets)

    You use i uninitialized.
  6. Replies
    32
    Views
    2,522

    do { printf("\n Number of tries left...

    do {
    printf("\n Number of tries left : %d", guess);
    printf("\n %s", letters_guessed);
    printf("\n Word to guess : ");

    for(i = 0;...
  7. Replies
    19
    Views
    4,250

    The return value of scanf is never going to equal...

    The return value of scanf is never going to equal '.'
    It will equal the number of successfully matched and assigned input items.

    The first letter you read in is not being used in your checksum...
  8. Replies
    10
    Views
    1,260

    Where? The original poster's usage of sscanf...

    Where?

    The original poster's usage of sscanf is correct. The first paramter should be char *
    As already pointed out the problem is with the format specifier for long and short

    %ld and %hd may...
  9. Thread: reading a file

    by spydoor
    Replies
    38
    Views
    4,097

    while (fscanf(fin, "%25[^ ]. %25[^ ].%c %c\n",...

    while (fscanf(fin, "%25[^ ]. %25[^ ].%c %c\n", Nlen, STU->LName, STU->FName, &STU->Sex,&STU->Grade) != EOF){

    Nlen, should not be there at all. You are trying to store a value in '25'

    You have...
  10. Replies
    18
    Views
    2,042

    The only place you ever try to write to the file...

    The only place you ever try to write to the file is in view_stud.
    It looks like you are trying to rewrite the file to itself. Why?
    Having the same file open for reading and writing is not good.
    ...
  11. Why do your cases ever return a trailing \ It...

    Why do your cases ever return a trailing \
    It looks like you always want \#

    I would think your cases should be more like...

    "\\8"
    "\\333"
    "\\555"
    ...
  12. Thread: array help

    by spydoor
    Replies
    31
    Views
    2,867

    The first parameter to your ArraySort function...

    The first parameter to your ArraySort function should be an array not an integer.
    Num is the name of your array.



    for (i = 0; i < Max && Num[i] != 0; i++)
    Num[i] will always be uninitialized....
  13. Replies
    41
    Views
    3,538

    void Calculate( loan *details ) { void...

    void Calculate( loan *details )
    {
    void Amortization ( loan *details );

    Try moving the Amortization prototype outside of your Calculate function. (near the other prototypes)

    change double...
  14. Thread: fgets

    by spydoor
    Replies
    16
    Views
    2,346

    Maybe if you print the string after fgets you'll...

    Maybe if you print the string after fgets you'll understand what is going on.

    But to try to explain:

    the loop is entered
    "Enter something :" is printed
    You type a string and hit enter
    16...
  15. Thread: strcpy

    by spydoor
    Replies
    7
    Views
    1,645

    Actually strcmp doesn't necessarily return 1 or...

    Actually strcmp doesn't necessarily return 1 or -1 but a number less than or greater than 0 if they differ



    The first retuns a negative number because 'H' is less than 'W'
    The second returns 0...
  16. Well you're not passing anything, so as long as...

    Well you're not passing anything, so as long as your array is being filled properly it should be available to all of your functions

    any function that does not return a value should be void

    ...
  17. Replies
    28
    Views
    2,704

    Nope. In one place you are delcaring a char* in...

    Nope. In one place you are delcaring a char* in the other you are using the variable that happens to be a char*

    the return type of your function is a char*

    int a;
    char* formula;

    a is an int...
  18. Replies
    17
    Views
    40,826

    Since you haven't learned functions yet ... ...

    Since you haven't learned functions yet ...


    int is_prime
    for all numbers you want to test {
    is_prime = 1 //start by assuming prime
    for (i=2; i < number ; i++) { //or a more efficient...
  19. Thread: my doggy class

    by spydoor
    Replies
    2
    Views
    868

    getage() doesn't print the age it just returns...

    getage() doesn't print the age it just returns it.
    either set it to a variable and do something with it, or just print it

    cout << anakin.getage() << endl;
  20. Replies
    6
    Views
    816

    I also suggest you don't use system, but of...

    I also suggest you don't use system, but of course it is possible.


    string name;
    string cmd;

    cout << "please enter a name... " << endl;
    cin >> name;

    cmd = "mkdir " +...
  21. Replies
    2
    Views
    849

    It's very difficult to follow what you are trying...

    It's very difficult to follow what you are trying to do

    by the time you get to here

    slist[i].stocknumber = atoi(tempstr);
    i will always equal numitems. You always run to the end of the for...
  22. Replies
    2
    Views
    1,119

    You need to pass roomnum as a pointer if you want...

    You need to pass roomnum as a pointer if you want findfree to change the value of it.


    findfree(&roomnum);

    int findfree(int *room)
    {
    ...
    *room = i;
    ...
  23. It seems like a safe way to do it would be to...

    It seems like a safe way to do it would be to open a new file.
    Write the new line to the new file.
    Write the contents of the current file to the new file.
    Then replace the current with the new.
    ...
  24. Replies
    22
    Views
    1,934

    esbo can you please give an example of a c...

    esbo can you please give an example of a c function that returns a "string" and not a char *
  25. Thread: Help

    by spydoor
    Replies
    12
    Views
    975

    where is main :confused: besides that your...

    where is main :confused:

    besides that your first line actually has 11 four character words not 10
Results 1 to 25 of 140
Page 1 of 6 1 2 3 4