That was a good one ;)
Type: Posts; User: maverix
That was a good one ;)
Agreed ;)
but i thought having large variable names for loop index would make the lines too long.
Well....here's my version, but I am not using strtok and storing the words in a string array, instead the original string is indeed reversed with the last word appearing first, last but one second...
This can be done in a better way!!!
void count(const char myStr[]){
declare an array of 26 integers to store the count of each alphabet
initialize the array variables to zero
...
how about declaring it
static int number = 0;
I guess (not sure) it would not initialize it each time it enters the loop. Somebody please confirm :-)
maverix
Hi,
Once the contest ends, will you be posting the best code so that others could learn?
cheers
maverix
better still, you could declare a structure as per the requirements and write it to files
#define STR_SIZE 20
typedef struct {
char string[STR_SIZE];
int a;
int b;
Hi everybody,
I had written this game long back but it was very primitive.
I've refined it a bit using curses library.
Check it out and let me know your feedback and suggestions. ;)
btw, the...
this would do...
for(i=1;i<=100;i++)
printf("door %d - %d\n", i, door[i]);
maverix
you are comparing two literals in the statement which is true forever...
for(i=1;1<=100;i++)
you need to change it to
for(i=1;i<=100;i++)
well, i thought palindrome is something which reads the same backwards, something like
"madam",
"civic",
"level",
"was it a rat i saw"
search through this forum with the keyword...
you've been answered on this a number of times.
hundreds = number/100; // for 1782, you'll get 17
cheers
maverix
hi lol...lol,
ah yes, a prettly long thread!!! however, this thread was not started by me
if you really care to know the problem statement, you could go to the first post of this thread ;-)
...
break the year 1782 into hundreds, tens and ones (as shown in my previous post)
break the year 1782 into hundreds, tens and ones (as shown in my previous post)
if(hundreds == 17)...
I am not sure whether you are supposed to use character arrays for your assignment, but nevertheless, all you need is
const char *unitStr[10] = { // string constants for unit places
...
Now that he's got the answer, I'd like to post my version
void processInput(int year, int month)
{
int leap = ( (year%4 == 0 && year%100 != 0) || year%400 == 0 )? 1:0;
//...
nice thread :-)
am going to start using a debugger now...
cheers
maverix
below is the equivalent while loop, this could give you an idea :-)
int i = 9;
i--; // initialization
while(i--){ // check the condition
...
one way to find out is to reverse the number and check if the resulting number is equal to the original number.
initialize r_num to 0
while num is positive
multiply r_num by 10 and...
check out this site for info on random numbers...its from one of the C board members
http://www.eternallyconfuzzled.com/tuts/algorithms/jsw_tut_rand.aspx
cheers
maverix
you can use strcat to concatenate two strings
for eg:
strcat(str1,".gb");
assuming str1 is a string with contents "AJ002507".
cheers
maverix
Go through K&R a number of times....you'll learn something new each time (at least, I did) :)
cheers
maverix
No, the type of tmp is the one which precedes it, 'test' in this case.
the typedef statement defines an alias for an already existing datatype or to create a new user defined datatype.
eg:...
that was a great post by iMalc :)
One needs to enjoy whatever he is involved in!!!
Don't give up, though!!!
Another way of arriving at the start and end limit is to start from factor 1 up, store the quotient in another variable, increment factor until it reaches the quotient. Make sure that you update the...