User Profile

Collapse

Profile Sidebar

Collapse
abrown07
abrown07
Last Activity: Apr 8 '10, 07:56 PM
Joined: Jan 31 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • abrown07
    started a topic what is wrong with compiling error
    in C

    what is wrong with compiling error

    When i try to compile:

    Code:
    #include <stdio.h>
    #include <math.h>
    #include <string.h>
    #include <stdlib.h>
    
    
    /* Function Headers*/
    double gravityFactor(double mass, double radius);
    double escapeVelocity(double mass, double radius);
    
        
    int main(void)
    {
         double mass, radius, gf, ev;
         int unit;
    ...
    See more | Go to post

  • abrown07
    started a topic Format output into table
    in C

    Format output into table

    Hi, I have the following code all complete and executes precisely.

    Code:
    
    #include <stdio.h>
    #include <math.h>
    #include <string.h>
    #include <stdlib.h>
    
    
    
    double gravityFactor(double mass, double radius);
    double escapeVelocity(double mass, double radius);
    
        
    int main(void)
    {
         double mass, radius,
    ...
    See more | Go to post

  • abrown07
    replied to Syntax error before = sign
    in C
    this is not fix the problem. and it was accepting them as inputs and giving me the correct outputs before i tried defining them
    See more | Go to post

    Leave a comment:


  • abrown07
    replied to Syntax error before = sign
    in C
    yes the constants have been defined before the main body of the program. Here is my entire program and the commented sections are just there to remind myself of what i still need to do with the program after i figure out this whole function thing.

    Code:
    #include <stdio.h>
    #include <math.h>
    #include <string.h>
    #include <stdlib.h>
    
    #define G = 6.667428e-11
    #define
    ...
    See more | Go to post

    Leave a comment:


  • abrown07
    started a topic Syntax error before = sign
    in C

    Syntax error before = sign

    Code:
     
    
    double gravityFactor(double mass, double radius)
    {  
         
         double gf;
        
          gf=((mass/Me)/((radius/Re)*(radius/Re)));
         
          return gf;     
    }  
    
    double escapeVelocity(double mass, double radius)
    {
        
        double ev;
         
         ev=(sqrt((2*(G)*mass)/radius))/1000;
         
         return ev;
    ...
    See more | Go to post

  • abrown07
    started a topic having trouble with string array
    in C

    having trouble with string array

    Hey,

    I'm having loads of trouble getting my strings to function properly I dont understand Im getting too few arguments to function errors for both and also getting excess elements in char array initializer errors multiple times over.


    Code:
    #include <stdio.h>
    #include <math.h>
    #include <string.h>
    #include <stdlib.h>
    
    
    int main(void)
    {
    ...
    See more | Go to post

  • abrown07
    started a topic Display output in table format.
    in C

    Display output in table format.

    How would I be able to neaten up my output by putting them in a table with the following headers:
    Stellar Body, Escape Velocity, Gravity Factor.
    I can get the outputs fine but I have them in coming out just continuously rather than in table format and I would like to tidy the program up.
    See more | Go to post

  • abrown07
    replied to How to incorporate a function.
    in C
    that seems simple enough but how do i do this for the function i need to create?
    See more | Go to post

    Leave a comment:


  • abrown07
    started a topic How to incorporate a function.
    in C

    How to incorporate a function.

    Hi,

    I have been doing more reading than necessary on functions and I still cannot figure out how to create the one I want to. and even if I could I do not know how to call upon it. SO I'm hoping i can get a little assistance on here. I need to create a function that will calculate the gravity factor for various planets. where the gravity factor = the mass of a planet/ mass of the earth divided by the radius of a planet/the radius...
    See more | Go to post

  • abrown07
    replied to Too few arguments for format.
    in C
    dummmb

    sorry , answered myself stupid question forgot to include ,grav and ,escape.

    could still use the help on the error in my formula though!
    See more | Go to post

    Leave a comment:


  • abrown07
    started a topic Too few arguments for format.
    in C

    Too few arguments for format.

    When I compile this I get the "too few arguments for format for both of my printf statements following my equations. Why is this? and as well it says there is an error in the first equation I have created.


    Code:
    #include <stdio.h>
    #include <math.h>
    
    
    
    int main(void)
    
    {
    
    double escape;
    double radius;
    double mass;
    double
    ...
    See more | Go to post

  • abrown07
    started a topic syntax/logic errors
    in C

    syntax/logic errors

    What are the syntax/logic errors in this code? I am confused between the two types.

    [code]

    int i;
    double pi;

    pi = 1.0;

    for (i=2; i<n, i=i+1)
    {
    if (i%2 = 1)
    pi = pi - (1.0 / ((2.0*i)+1));
    else
    pi = pi + (1.0 / ((2.0*i)+1));
    }

    pi = pi * 4.0;


    [code]/*


    ...
    See more | Go to post

  • abrown07
    replied to Loop won't iterate
    in C
    that is too many arguments for the format i had tried it previously do you know of any other way it could work?
    See more | Go to post

    Leave a comment:


  • abrown07
    replied to Loop won't iterate
    in C
    Thanks,
    that was an easy fix!! Im glad haha

    also do you know of anyway that the output statment can include a count as well, like say I want to give 50 generations of output right now I have it stating

    "The population at the next generation will be : "
    50 times all the way down.

    is there anyway that I can make the output say:

    "The population at generation 2 will be:...
    See more | Go to post

    Leave a comment:


  • abrown07
    started a topic Loop won't iterate
    in C

    Loop won't iterate

    I am trying to create a program and it works perfectly except the program ignores my loop. Here is the piece of the code that this involves:

    Code:
    printf("Please indicate how many generations you wish to calculte: ");
       scanf("%d", &generations);
     
     
     
      for(n=1; n==generations; n++) 
         {
          Population=initial*exp (growth*(1.0-(initial/capacity)));
    ...
    See more | Go to post

  • abrown07
    replied to Continuation of a program in C
    in C
    where is the population+=pop ulation supposed to fit in? that is the part i do not understand!
    See more | Go to post

    Leave a comment:


  • abrown07
    started a topic Continuation of a program in C
    in C

    Continuation of a program in C

    Hi I have the following code:



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

    int main(void)

    {

    double Population,capa city,initial;
    int generations;
    float growth;


    printf("Please give the carrying capacity of the environment: ");
    scanf("%lf", &capacity);

    printf("Please...
    See more | Go to post

  • How to use input from first operation as variable in second operation

    How do I get the program to take the "Population " calculated from the first time and use it as the "initial" variable for the next calculation. And for it to continue to do this for generations 2 on each time taking the previously calculated Population and using it as the variable "initial" for the next calculation. With what I have right now when I run the program it just kind of... pauses after I give all the inputs....
    See more | Go to post

  • abrown07
    started a topic How to use an exponent?
    in C

    How to use an exponent?

    Another noob question.
    How do i write out an exponent in my C code.

    I want to say

    Population= N*exponent(r)
    See more | Go to post

  • abrown07
    replied to How do I say not equal to more than one number?
    in C
    im using gcc for mac , so how would i format that to say and?
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...