I wanted to see if rand can generate two dimensions like
numbers [] []
and make sure they are not repeating. ex: row != row && col != col.
should i just add another for loop under
for(c = 0;...
Type: Posts; User: maybabier
I wanted to see if rand can generate two dimensions like
numbers [] []
and make sure they are not repeating. ex: row != row && col != col.
should i just add another for loop under
for(c = 0;...
i don't quit understand how this part works
do
{
ball = random() % RANGE;
}
while(numbers[ball]);
this program draws random lotto numbers using arrays.
it does make sure the numbers don't repeat.
I want to know how to write it as a 2D array.
heres the code
#include <stdio.h>
#include...
That was magical!
Thanks
I thought I should pass the pointer value, and the pointer value will change according to entry. then it will change the value where it points to.
What's the difference?
I'm writing a program that detects character entry and move a submarine that's on the display. here is the move code.
h moves left, j moves down, k moves up, l moves right.
the ocean is a 6x15 box....
#include "presults.h"
#include "display.h"
#include "chrutil.h"
int put_result(int ans)
/* This function is given an integer and prints it one digit at a time
either to the calc display or...
aha!
i got it!
thank you very much!
sorry.. i don't quite get the code.
ch is defined as int?
what does it mean when its != 1.
I am writing a program that:
scanf is set to read in an integer value,
when it reads char it goes into an infinite loop.
The program should instead, print an error msg and break out of the loop....
this is my new idea:
in main:
while (num != EOF)
if !is_hawaiian, print invalid
else, print valid
in is_hawaiian:
ch=getchar()
hmmm. that's big help!
thank you so much!
i just saw that...
i am not really familiar with those character things, i think i will read the book more and spend a few more hours on this.
i'm...
ohh you guys are so helpful.
i usually am really neat about how i write the codes,
but when i get frustrated i just add on and erase where ever till i get it to work then fix it.
about...
gotcha!
Thanks so much
I just have one question.
Why does it make a difference?
It's in the same function!!!
Seems like you are right.
I moved the statement if it's not roman down with the statement EOF, it works now....
I'm gonna test more data, hopefully it works for everything!
Hmm. I know.
I worked on this yesterday afternoon for like 5 hours.
now for 3 more. still can't get this thing to work.
I found something though,
it seems like if i enter XXXXA, it prints 40.
if...
main()
{
char ch;
char last_ch;
int inword;
int hi;
/* we are not in the word at the beginning */
inword = FALSE;
/* ...
I have found more problems now.. Oh I hate this.
Enter an number in roman numerals(EOF to quit): cccccccccccccaddddddd
The number is 1300
Enter an number in roman numerals(EOF to quit): The...
I included
while(!is_roman(rdigit) && !IS_WHITE_SPACE(rdigit) && rdigit != EOF) return 0;
in get_roman should get it taken care of...
not sure....
but even in get_roman function, when it reads an invalid, return 0,
0 should update the "number" value and it should just print error.
what am i missing?
I've been messing with main().
It seems like everything should be in a loop.
It makes sense to me that if it reads an invalid it should only print error.
#include <stdio.h>
#include...
this is where delimitp located.
#include <stdio.h>
#include "tfdef.h"
#include "chrutil.h"
/* Function returns TRUE if c is a delimiter, otherwise FALSE */
You are correct.
enter VCZ,
When Z is read, the program should ignore the "VC" calculation and just print error.
(mine prints the result of VC instead of error)
If there is any non roman numeral,...
it's skipping every other character, doesn't matter what it is..........
i wish it would understand me more... >_<
so frustrating!
while(!is_roman(rdigit) && !IS_WHITE_SPACE(rdigit) && rdigit != EOF) return 0;
it returns 0 when it detects a non roman digit and it's not white space or ctrl d.
the while loop you quoted...