Thread: hello, please can i have some urgent help!

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    21

    Smile hello, please can i have some urgent help!

    alright, sry to be another homework lout,


    programmin is not my forte but is one of my modules... i am expected to do this program, however i am baffled. need it done today... so i AM open to bribes. lol.

    this should tho, i assume, be very easy for the experienced programmer.


    Please do what you can. many many thanks!!



    ......


    For a single cylinder in potential flow, moving with a velocity of magnitude V(infinity), the velocity at any point on the surface of the cylinder is=

    v=2V(infiniti)sin(theta)


    the pressure coefficient is given by :

    C(p) = 1-4Sin^(2)(theta)

    pressure coefficient on surface of sphere:

    C(p) = 1-9/4Sin^(2)(theta)


    (theta) is the angle measured from the direction of the parallel flow to a point on the surface of the sphere.




    now, the program.


    construct a program for a user who need to calculate the potential flow around a circle and sphere.

    Your program sould include the following:

    a. A function for calculating velocity and pressure coefficient around a circle.
    b. A function for calculating velocity and pressure coefficent around a sphere.
    c Program output should be stored in a file specified by the user.

  2. #2
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    In general here on the forums we don't give out code (especially homework code), unless the OP (that's you), shows us that you have at least tried to do some of it first.

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    21
    alrite well, i dont know how to do this task
    however i can show you the code i have done which was a similar task, for finding the coordinates of an element of a square.



    printf("Please enter the element number you wish to know the position of: ");
    scanf("%f", &number);

    if (number > 25)
    printf("\nInvalid element number entered, following data is irrelevant\n");
    else
    printf("\nThank you\n\n");

    if (number < 6)
    coa=number;
    else
    if (number < 11)
    coa=(number-5);
    else
    if (number < 16)
    coa=(number-10);
    else
    if (number < 21)
    coa=(number-15);
    else
    if (number < 26)
    coa=(number-20);
    else
    printf("\nInvalid element value entered, please close program and start again\n\n");

    if (number < 6)
    cob=1;
    else
    if (number < 11)
    cob=2;
    else
    if (number < 16)
    cob=3;
    else
    if (number < 21)
    cob=4;
    else
    if (number < 26)
    cob=5;
    else
    printf("Invalid element value entered, please close program and start again\n\n");

    co1=(coa-1);
    co2=(cob-1);

    printf("Co-ordinate 1 = %d,%d\n", co1, co2);
    printf("Co-ordinate 2 = %d,%d\n", coa, co2);
    printf("Co-ordinate 3 = %d,%d\n", co1, cob);
    printf("Co-ordinate 4 = %d,%d\n", coa, cob);
    getch();
    return 0;

    }

    (floats are coa etc )

  4. #4
    Registered User
    Join Date
    Jan 2007
    Posts
    21
    please just show me the way if you don't want to give me code

  5. #5
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    1 Use code tags when posting code

    2 I hope that is neatly indented on your editor

    3 This is C++ forum, post this on the C fourm board

    4 You still have not shown your attempt at the exact problem. As Twcomers stated, no person here will write the solution for you. Give it a go and post your code using code tags and then we can take a look and make suggestions or give useful comments.
    Double Helix STL

  6. #6
    Registered User
    Join Date
    Jan 2007
    Posts
    21

    Angry hairy muff.

    so much for the help for 2moro... nevermind

    i didn't intend to post that code perfectly. I typed it quickly.

    it is C++ I am using therefore I am in the correct forum. ...I know cout is easier

  7. #7
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    printf() and scanf() are C functions

    Oh and I don't appreciate being called a hairy muff either, if that is what you meant in your reply heading.

    Like you said, cout is a C++ object, and it is quicker to do this:

    Code:
    std::cout << "Enter your name: ";
    std::cin >> name;
    To this:

    Code:
    printf("Enter your name: ");
    scanf("%s", &name);
    But that is rather irellevant. Do you know how to go about the problem you have? If you are stuck for a program solution, use pen and paper and draft a TDD ( top down development ) of the program. If it looks like it will work, code it in C++ and see what happens.
    Last edited by swgh; 01-14-2007 at 12:03 PM.
    Double Helix STL

  8. #8
    Registered User
    Join Date
    Jan 2007
    Posts
    21
    just 'fair enough'

  9. #9
    Registered User
    Join Date
    Jan 2007
    Posts
    21
    nope i don't know how to do it. i posted that code because, i believe an extended approach from my previous work is probably expected of me.

  10. #10
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Well for the file output part, you will have to use the library fstream. If you are unsure on this look at FAQ about file io.
    If you are still really stuck, get a good beginners book, the link on this site has some good recomended ones. If you hate reading loads, avoid the detiel series ones.
    Double Helix STL

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. display character size...(quite urgent..)
    By karthi in forum C Programming
    Replies: 10
    Last Post: 07-11-2007, 09:42 PM
  2. beginner plzz help urgent
    By sara101 in forum C Programming
    Replies: 11
    Last Post: 01-14-2007, 10:38 PM
  3. Linked List Need Help Urgent
    By ykchua in forum C Programming
    Replies: 5
    Last Post: 08-17-2004, 02:57 PM