Search:

Type: Posts; User: MisterBadger

Search: Search took 0.01 seconds.

  1. Thread: help

    by MisterBadger
    Replies
    5
    Views
    1,094

    This worked for me (eventually...): #include...

    This worked for me (eventually...):


    #include <stdio.h>

    int main(void)
    {
    char strtest [18] = "keith chad boards";
    char strtest1[18];
  2. Thread: sscanf

    by MisterBadger
    Replies
    2
    Views
    1,651

    Hello cheryl_li #include int...

    Hello cheryl_li


    #include<stdio.h>

    int main(void)
    {
    char *line="Other Names=Andrew", header[20], content[20];

    sscanf(line,"%11c=%s\n", header, content);
  3. Replies
    2
    Views
    1,791

    Hello, volk Before the line: ...

    Hello, volk

    Before the line:

    printf("\nEnter three more numbers\n");

    you have omitted to re-initialise variables i and sum to zero...

    Cheers from MrB :)
  4. Replies
    5
    Views
    1,744

    Hi GaPe I used your Multiply function with...

    Hi GaPe

    I used your Multiply function with printf to display a*b.

    Do you really need the Multiply function? This line would give the same result:

    printf("\nProduct of %d and %d is...
  5. Replies
    5
    Views
    4,274

    Hello Basia. Was your attempt at the code...

    Hello Basia. Was your attempt at the code something like my effort?
    With a variety of expressions in the for loops, I came up with this:


    #include<stdio.h>

    #define MAX 10 /*The maximum...
  6. Replies
    4
    Views
    1,297

    Hello All... The following is a variation on a...

    Hello All...

    The following is a variation on a program which maintains consistent string lengths before writing the array of structures to a text (or binary) file.

    Following each user input,...
  7. Replies
    181
    Views
    69,438

    More milk please...

    MisterBadger says:

    Using pi to 7dp, working in millimetres:

    radius of sphere, r = 55mm

    Volume of sphere = 4/3*pi*r*r*r;

    Overall Volume = 4/3 * 3.1415926 * 55 * 55 * 55;
  8. Replies
    13
    Views
    3,595

    Mr Shiro said: By using the exit() function...

    Mr Shiro said:

    By using the exit() function defined in stdlib.h open streams are closed before program termination. exit(1); in this case is the same as exit(EXIT_FAILURE); Hence my use of this...
  9. Replies
    13
    Views
    3,595

    Is ThIs Ok... #include...

    Is ThIs Ok...



    #include<stdio.h>
    #include<stdlib.h> /* for exit() function */
    #include<ctype.h>

    int main()
    {
  10. Replies
    3
    Views
    1,644

    variable 'c' should be a char and the format...

    variable 'c' should be a char and the format specifier will need to be a %c:


    #include <stdio.h>

    int main()
    {

    char c;
  11. Replies
    5
    Views
    14,694

    The code for the key is 0x1B (no quotes)...

    The code for the <Escape> key is 0x1B (no quotes) if that's what you're after...


    printf("* * * * * MAIN MENU * * * * *\n\n");
    printf("PLEASE SELECT:\n\n");
    printf("SOMETHING #1...
  12. Replies
    1
    Views
    889

    ...spaced out...

    I noticed a space before %lf as commented below. Removing this allowed the program to run.

    I added the line: i1/=100.0; which gave a correct outcome to the compounded values. I'm not an...
  13. Replies
    2
    Views
    979

    If the data structure of the file data is known,...

    If the data structure of the file data is known, successive strings can be read from the text file using fscanf(). Each %d in the function call will account for a minus sign and store a negative as...
  14. Replies
    6
    Views
    1,254

    Yes, I got the code tags wrong... Sorry! MrB

    Yes, I got the code tags wrong... Sorry!

    MrB
  15. Replies
    6
    Views
    1,254

    Here's my offering...

    Q1.
    [code]
    float myNum=25.52, *n_ptr;
    n_ptr=&myNum;
    printf("%f",*n_ptr); /*Value at address pointed at by n_ptr will be displayed on screen as 25.52*/
    [\code]

    Q2. Adding 1 to...
  16. Replies
    2
    Views
    838

    This code seems to work for any number of spaces...

    This code seems to work for any number of spaces either side of the 'x'... as long as the "change" array is long enough, of course...



    #include<stdio.h>
    #include<string.h>

    int main()
    {
    ...
Results 1 to 16 of 16