Wow thank you! So stupid mistake.
Type: Posts; User: Covalent
Wow thank you! So stupid mistake.
Hey, so I have this here:
char *item;
item=&fact[numero].transactions.items[k].noItem;
'noItem' is a char too. For some reason, the program is doing as expected, the good value is read...
OK I fixed it. Here is the final solution :P (The printf is there to see where the while stops to be sure it stops at the right spot)
void ajouterFacture(Caisse* caisse, Items* inventaire, int*...
Yes I know! I tried "0", '0' and plain 0, but when I try the NULL one, k is just not the good answer (it returns me 10, but I'm expecting something like 4-5)
And if I put NULL or 0, I get a...
Well, yes, at the very start of the program (sorry if I didn't explain it), my structure is filled by reading a .dat that contains all the informations of the inventory and then the already existing...
Hey, so I'm doing a little work with structures. It's a simulation of a shop. Here are the structures:
typedef struct
{
char noItem[LONG_CODE]; // le numÈro de líitem
int...
Well sorry, I meant a full keyboard that included too 0 to 9 ^^'
And what if I know it's a keyboard with numbers from 0 to 9? :P
Hi,
So I get this simple thing here, meant to get a number between 1 and 12. The problem is, in my program, if I enter a character, I get an infinite loop and I just can't find a way to fix it....
I did meant /1000000000 but now that you're telling it, I'm not sure it's the best option.
I changed it for modulo 10 and it's quite well working. Wow, really thank you all! But now still I got...
Ok I just forgot to add srand(time(NULL)); in my declaration. Still, every 12 digit number I get only has 0-1-2, never something else...
Ok, I renamed and it's working, thank you!
And I saw what you meant by "what you will get will be interesting", I corrected the &d in the printf for %d.
But now, I always get the same numbers,...
But if I write while (rando!=9), wouldn't that make loop my function until I do get a 9?
Here is my code corrected.
#include <stdlib.h>
#include <stdio.h>
Wow, yes, that ; after the while indeed fixed a lot of things! Thx for that!
The while (rando=9) is there so the random generation number continues until I get a number else then 9.
For your...
Yeah well, I know it would be better, but we just can't use Arrays, specification in the homework ^^' Else I would have done that :P Same thing for character chains, we can't use them.
I'm trying to do a program that randomly generates 12 digits, not equal to 9, using pointers. But I get some pretty nasty errors and I just can't understand what's wrong. I'm using XCode on Mac OS X....