User Profile

Collapse

Profile Sidebar

Collapse
orangeworx
orangeworx
Last Activity: Nov 20 '08, 04:54 PM
Joined: Nov 17 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • orangeworx
    replied to C programming
    in C
    I appreciate your input guys.... I've managed to work that out by using a MAX value for the tables... since dynamic tables aren't what we were asked, i was going around in circles but as soon as I had changed the table initialization to a finite number of elements, everything worked out great.

    here's the final version if any1 is interested
    Code:
    /* Ce programme saisi des données sur des animaux etudiés par une biologiste:
    ...
    See more | Go to post

    Leave a comment:


  • orangeworx
    replied to C programming
    in C
    i just ran some more tests...

    here's my code for now...
    - the "females under 1kg" counter is not work at all now, i'm guessing it's not the condition since it worked earlier but i have no idea what change in the code affected it
    - the age is completely stupid.
    - still need to figure out the average age calculation since the commented lines are causing my program to crash (windows send report window) when...
    See more | Go to post

    Leave a comment:


  • orangeworx
    replied to C programming
    in C
    the only issue with this is that i don't have a max number of animals... you're saying that having constraints is the only option ?...
    See more | Go to post

    Leave a comment:


  • orangeworx
    replied to C programming
    in C
    if i don't specify nbrAnimaux to 0 the whole program crashes when run (MS send report window)
    the weird part of this is that the other tables are fine...

    also what do u mean by dynamic allocation?...
    See more | Go to post

    Leave a comment:


  • orangeworx
    replied to C programming
    in C
    yeah my bad, i had noticed and changed that but the reason i had this loops is to clear the age table as it's giving erroneous data.... but then took it out again as it proved useless...
    See more | Go to post

    Leave a comment:


  • orangeworx
    replied to C programming
    in C
    new code... works a whole lot better, just a couple glitches

    Code:
    /* Ce programme saisi des données sur des animaux etudiés par une biologiste:
          - 1ere ligne, leur nombre, pour créer les tableaux qui contiendront
            les infos
          - 2eme ligne et + (jusqu'au nombre saisi à la première ligne), leur sexe
                 (M ou F, char), leur age (en jours, int), leur poids (en kg, réel)
    ...
    See more | Go to post

    Leave a comment:


  • orangeworx
    replied to C programming
    in C
    i'm still having some problems coding this...
    i'm not sure where to "look" to fix whatever i'm trying to do....
    i really don't understand why the age table is being filled with bogus info so is the sex one... it's storing some weird characters instead...

    edit: i didn't really explain what the program should be doing so here it is

    first, the user inputs an int which is used to initialize the tables...
    See more | Go to post

    Leave a comment:


  • orangeworx
    replied to C programming
    in C
    Been trying to tweak the code, still to no avail (maybe a little better than before)
    i tried to print out the values of the tables before running the program and the int/char tables are displaying weird stuff

    here's some info
    SVP entrez le nombre d'animaux pour vos calculs:
    4
    tableau sexe: ┘
    tableau age: 37813980
    tableau poids: 0.000000
    tableau poids: 0.000000
    tableau sexe:...
    See more | Go to post

    Leave a comment:


  • orangeworx
    started a topic C programming
    in C

    C programming

    Been getting some help from you guys and i really appreciate it and hope some1 will have some idea y i'm getting oddities

    Here's my code and i'll explain in between.

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <ctype.h>
    #define HAUTEUR 30.0
    #define POIDS 1.0
    
    int main()
    {
    	// initialisation des variables
    	int nbrAnimaux=0;
    ...
    See more | Go to post

  • orangeworx
    replied to C - Calculating Perfect Numbers
    in C
    that's the code i have for now... it's like the calculations are doing nothing... i can "see" what the loop is doing, i'll put some prinft to see how the variables are acting up.

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    main()
    {
       // initialisation des variables
       int nbrMax=0;                        // Nbr d'entiers à saisir
       int produit=0;
    ...
    See more | Go to post
    Last edited by orangeworx; Nov 17 '08, 07:27 PM. Reason: pasted code many times ... oops

    Leave a comment:


  • orangeworx
    replied to Change calculation in C
    in C
    If i set nbrMax to 0 there and get the user input affected to it... should work right?...
    See more | Go to post

    Leave a comment:


  • orangeworx
    replied to C - Calculating Perfect Numbers
    in C
    i don't want to reset my sum every j loop because i need to verify if the sum = table member then it's a perfect number....
    See more | Go to post

    Leave a comment:


  • orangeworx
    replied to Change calculation in C
    in C
    it's canadian dollars and we have 2 and 1 dollar coins... :P...
    See more | Go to post

    Leave a comment:


  • orangeworx
    replied to Change calculation in C
    in C
    had to use fflush because when a number outside the range was inputted, that number stuck in memory and gave erroneous change results

    i realized after my post that I was using an imaginary function.... and the 0.5, as i've looked it up, was the solution given to float to int conversions, oh didn't i mention i was really rusty...

    that line was added by Dev-C++ and i don't think the teacher knew what he was talking about...
    See more | Go to post

    Leave a comment:


  • orangeworx
    replied to C - Calculating Perfect Numbers
    in C
    how about, if i try to do the calculation for 1 integer first and then build a table around it... coz then instead of dealing with 1 i'd be dealing with a for loop on a table list of elements, right ?
    See more | Go to post

    Leave a comment:


  • orangeworx
    replied to Change calculation in C
    in C
    oh wow i am an idiot... pasted the wrong code....

    here's the actual one
    Code:
    #include <stdio.h>
    
    main ()
    
    {   // initialisation des variables
    
       float monnaie;                            // Nombre entré par usager
       int cents=0;                                // variable utilisée pour les calculs
       int validation;
       char condition;
       // Boucle
    ...
    See more | Go to post

    Leave a comment:


  • orangeworx
    started a topic C - Calculating Perfect Numbers
    in C

    C - Calculating Perfect Numbers

    Ok so I've been away from math for a long while now (and programming for that matter) and I've got this assignment that i'm kinda stuck on

    i'll paste my code at the bottom... it's not complete, i'll say that now but i just need some1 to steer me in the right direction.
    As i'm not entirely familiar with the calculations of the perfect numbers ( i know what it means just not entirely sure of how to code it)

    ...
    See more | Go to post

  • orangeworx
    started a topic Change calculation in C
    in C

    Change calculation in C

    Hey guys, I'm not really a beginner in this, i can read and write code with enough ease but this is a whole new thing for me... i've written some code to give me the exact number of change (coins) when giving a number between 0 (inclusive) and 5 (non-inclusive)
    the problem i'm having is, for example, when i put certain numbers, i'm getting a wrong count of change... off by 1 penny only
    it's very bizarre...

    Code:
    
    
    ...
    See more | Go to post
No activity results to display
Show More
Working...