Search:

Type: Posts; User: Brewer

Search: Search took 0.01 seconds.

  1. Replies
    12
    Views
    5,174

    Right so I've made the swap thing into a function...

    Right so I've made the swap thing into a function and my code is as follows:

    char swap2(char word2, int length)
    {
    char temp[1];
    int i;
    int j;

    for(i=0; i<(length-2);i++)...
  2. Replies
    12
    Views
    5,174

    Yeah he introduced Bubble Sort to us today (well...

    Yeah he introduced Bubble Sort to us today (well he actually described what it is, and we had to implement it), so I reckon that that is the right way to attack this problem. Thanks for your help...
  3. Replies
    12
    Views
    5,174

    Putting a word in alphabetical order.

    I'm trying to put a word into alphabetical order (i.e. so that the letters contained within are in alphabetical order), but do you have any idea how I would do this with a word of unknown length?
    I...
  4. Replies
    5
    Views
    16,243

    What does strcmp actually do?

    I have in my notes that strcmp will compare 2 strings with each other. But how does it do this? I mean would it say that abc and cba are the same, or are they different things? I.e. does it just...
  5. Replies
    5
    Views
    1,892

    Could you run me through in words what this is...

    Could you run me through in words what this is doing? I don't quite follow it in code.

    Thanks
  6. Replies
    5
    Views
    1,892

    if(for(k=0;k

    if(for(k=0;k<strlen(word);k++))
    {
    temp[k]=@
    }, printf("%s is an anagram of...
  7. Replies
    5
    Views
    1,892

    If statement conditions

    Can I use a FOR loop as part of the condition for an IF statement?

    For example, my problem is to create a program that will read in a string and compare it to a dictionary file in order to find...
  8. Replies
    10
    Views
    1,680

    Thats exactly how I was reading in the name, but...

    Thats exactly how I was reading in the name, but I've got it so there is an array for forename and one for surname, and two scanf statements.
  9. Replies
    10
    Views
    1,680

    Not so much no. I'm sure it can cope with about...

    Not so much no. I'm sure it can cope with about 40 extra bytes being used maybe?
  10. Replies
    10
    Views
    1,680

    That doesn't sound like too much fun! How I said...

    That doesn't sound like too much fun! How I said above that I was going to do it doesn't work. It compiles first, but it now crashes, which isn't a whole lot of laughs either. I might just have a...
  11. Replies
    10
    Views
    1,680

    Yeah I had a feeling thats how it works, just...

    Yeah I had a feeling thats how it works, just wondered if there was a way of doing it in that sort of manner. I know I could allocate a large amount of memory to it, but that seems like rather a...
  12. Replies
    10
    Views
    1,680

    Array length problem

    I'm trying to set up two arrays that will store the surname and forename of a person when prompted to enter it. However, because the name could be anything when entered, I don't know what size to...
  13. Replies
    13
    Views
    2,725

    My next stage has to been to ask for and define...

    My next stage has to been to ask for and define the value of N within the function itself rather than relying on passing it across from the main code. Yet its still not being defined correctly. My...
  14. Replies
    13
    Views
    2,725

    It appears that a divison by zero is happening,...

    It appears that a divison by zero is happening, as N isn't being defined for some reason.

    Surely

    printf("Please enter the number of intervals over which the integration is to be made (must be...
  15. Replies
    13
    Views
    2,725

    I thought I'd defined x to be less than b in the...

    I thought I'd defined x to be less than b in the first place (as long as a was less than b, which being the lower limit of the integral it will be).

    But if x was greater than b the loop wouldn't...
  16. Replies
    13
    Views
    2,725

    Nope. That makes no difference to the answer. I...

    Nope. That makes no difference to the answer. I thought that what I'd written there was count (which should increase by one every loop) divided by 2 and giving the remainder (i.e. a check for even...
  17. Replies
    13
    Views
    2,725

    I don't understand. I thought that was saying...

    I don't understand.

    I thought that was saying that while x was less than b, it would continue to do the loop, and as x increases everytime it would only loop a finite number of times (i.e. until x...
  18. Replies
    13
    Views
    2,725

    Can you spot my mistake?

    As part of a homework assignment my program has to have a function which will carry out Simpson's method for integration. Anyway my function is given here:


    double function1(double a, double b,...
  19. Replies
    8
    Views
    2,000

    #include #include...

    #include<stdio.h>
    #include<stdlib.h>
    #include<math.h>

    int main (void)
    {
    const float litres2pints=1.76;
    const float pints2floz=20;
    float a;
    float b;
  20. Replies
    8
    Views
    2,000

    The only value that takes the one I expect it to...

    The only value that takes the one I expect it to is a. The others just display themselves as 0.

    Any idea how I go about changing the warnings level on Dev C++?
  21. Replies
    8
    Views
    2,000

    When compiled the compiler tells me that there...

    When compiled the compiler tells me that there are no errors in the code. It just doesn't do the conversions.

    With regards to a haven't I defined it so that I can enter a value for it and all...
  22. Replies
    8
    Views
    2,000

    New programmer - please help!

    I've only just started a course in C Programming, and I've never done any programming before. My exercise asks me to write a program that converts litres into pints and fluid ounces. I have written...
Results 1 to 22 of 22