Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 86,399 C++ Programmers. There are 1,466 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a C++ Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

need help in C progaming!

 
Reply to this topicStart new topic

need help in C progaming!, desperate pls!! :(

zattara13
post 9 May, 2008 - 11:39 AM
Post #1


New D.I.C Head

*
Joined: 27 Mar, 2008
Posts: 23



hi. i need help. i have a program that generate a number between -1 and 1 for 10,000 times. it is in a function. now i need to write another function so that for every number generated, i find the arcsine of it and get the output by 90 degrees. i've been up all night programming and now i came to this and i feel like sh*t. pls give me some help. my brain is not thinking anymore maybe you can help me out pls. very desperate. 10x ppl

CODE


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

#define SIZE 100


int random_no (float x);
int partD (float y);


int main (void)
{
    float num;
    float y;

    int array1[101][181] = {{0},{0}};

    partD (y);

    return (0);
}

int random_no (float x)
{
    int i;

    srand (time(NULL));
    
    for (i=0; i<10000; i++)
    {
        x = ((float)rand() / (RAND_MAX) * 2 ) -1;
        printf ("%d. %f\n",i+1, x);
    }

    return (x);
}

int partD (float y)
{
    int i;
    // this right here.... i need to fix this!! must get it working! :@
    random_no (y);
    y = 1/(sin(y));
    printf ("%f\n", y);
    
    return (y);
}

User is offlineProfile CardPM
Go to the top of the page
+Quote Post


Cerolobo
post 9 May, 2008 - 11:54 AM
Post #2


D.I.C Head

**
Joined: 5 Apr, 2008
Posts: 151

arcsine is not the same as 1/sin

x = sin(y)
y = arcsine(x)

You need to use the proper function, asin().

As for rotating by 90 degrees, that's just Pi/2
http://www.sdfjkl.org/hosting/lslwiki/degrad.gif
User is online!Profile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
Time is now: 5/17/08 06:23AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month