~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

These people are simply boycotting me for their own reasons.

Hold it buddy, everyone makes mistakes, and the same must have happened by looking at your code.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

who was nowhere..

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I blame you if I do poorly of my finals tomorrow :p

highest so far: 1663630

Damn...you really must be crazy man..I got only till 13k in my first attempt. God save your final exam scores...:D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

break up -> up up and away

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

In the dark of night, creatures of the hell lurk.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

great movie -> date movie

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Man and animals should live in harmony. (bleh..couldn't think of anything else)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Bah, a preposterous..

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

1) Whats the easiest (Free) programing language to create this?

I would have said VB.NET but since its a proprietary language(you have to pay for getting it ) my next best bet is C# if you want to make it windows only or Python if you want to make your application portable.

Both are good languages which don't overload the newbie with all the details and focus on the actual coding..Also C and C++ don't as such support native graphics so for menus and all that you would have to use GTK+ or wxWidgets, both are difficult to use for a beginner.

My opinion: If you haven't started any language as such, jump into Python ( or C# ) and you would be a happy man.

Thank you.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Sentences written in this thread are no more than nonsense.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

splint -> splinter cell -- pandora tomorrow :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

the ghostriders think

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I have seen a lot of people mention "discworld" here.

What kind of novel or book is it ? Does it fall under the same category as LOTR? What is the concept used in these books ?

Thank you.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The ability to answer this question on your own is part of the process called debugging. It's a skill you're going to need to prosper in this endeavor so you might as well learn how to do it early.

The code won't even compile so how does the question of "debugging" come into the picture ?

@queenma7

The proper way to initialize struct variables is :

typedef struct
{
   string name ;
   int count ;
} Drink ;

int main( )
{
   Drink aDrink = { "cola", 20 } ; // one way
  
   Drink arr_drink[2] = { { "cola", 3}, {"pepsi", 5} } ; // another way
   
   arr_drink[0] = { "cola", 3 } ; // error, won't work

   // third way of doing it
   for( int i = 0 ; i < 2; ++i )
   {
        arr_drink[i].name = "" ;
        arr_drink[i].count = 0 ;
   }
   return 0 ;
}

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

of the castle.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

What I mean is :

// if the element of array matches with another element in the same 
// array, then increment the counter.

if( my_array[i] == my_array[j] ) 
{
     ++counter ; // counter = counter + 1
}

// my_array = {1, 2, 1, 3, 4, 5 }
// my_array[i] = my_array[0] = 1 
// counter = 2 ( since 1 has a match at 0th and 2nd position )

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

fiendish creatures of

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

joule effect -> cause and effect

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Perfection is what professionals aim for.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hmm..if thats the case then all you are required to do is to use nested loops. Here is a short algorithm:

  • Create a variable count which will keep track of the occurances of the numbers.
  • Start an outer loop with i as the counter or index, initialize it with 0 and continue looping till i is less than the number of elements or till all the elements have been visited.
  • Create an inner loop with j as the counter, initialize it in the same manner as the previous loop.
  • Inside the inner loop check if my_array equals my_array[j] and if it does, increment the counter by one.
  • Close the inner for loop and after the loop completion, print out the value of counter which should be the number of times the element my_arrayhas occured along with the element under consideration.
  • Reset the counter value back to zero for the remaining elements.
  • Keep looping the outer loop till all the elements have been visited.
  • End.

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

First of all use int main( void ) and not just main( ) since its not standard.

Don't hard code values in your program, if you want to process 20 values make a preprocessor defination at the start of your program which can easily be modified if you are asked to change the requirements. Using magic numbers as such causes a lot of confusion.

Can you give us a sample run or a dummy example of what kind of output you are expecting ? Are you required to store the occurances or just display them?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Jobe, my very first reaction would be, why not write a generic function instead of restricting yourself with search strings of length 2 or 3.

goes out of bound. Isn't that bad coding?

Its not bad coding, its wrong coding. How can you expect your program to perform properly and in the right manner if you are basing your programming logic on computations on areas of memory which don't belong to you ?

Also the trick which you use will soon turn out to be cumbersome if you are asked to do the same with 3 letters, 4 letters, n letters etc.

My thoughts: always look for generic patterns in the problem statement and if they don't incur additional overheads for that case, go ahead and implement them.

For eg here is one implementation which is possible. I haven't tried it but it should pretty much work.

// retuns the last position in the string where the match was found
// modifies the count parameter passed by reference which displays the
// number of times substring occurs.
int my_strstr( const char* str1, const char* str2, int* count )
{
    int i = 0 ;
    int len1 = strlen( str1 ) ;
    int len2 = strlen( str2 ) ;
    int pos = 0 ;

    *count = 0 ;    // initialize the counter

    for( i = 0; i < len1; ++i )
    {
        if( strncmp( ( str1 + i ), str2, len2 ) == 0 )
        {
            (*count)++ …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Naa...being a programmer doesn't give me much time to do all that, but still I dream of learning guitaring someday.

Looks like you in one...:D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

.So in the

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

joules -> joules law

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Well I don't know which bands have you explored till now so I will just name some random names which I personally like :

  • Theory of a deadman
  • Coheed and Cambria
  • Avenged Sevenfold
  • Incubus
  • Switchfoot
  • Jimmy Eat world
  • Alkaline Trio
  • Seether (best)
  • 12 stones
  • Saliva

And many more... If you have not tried any one of these you can head over to www.youtube.com and search for them and see if you like it or not.

Bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You can try out Ragnarok online. Its for free.

You can download the setup files by googling for them.

The only thing is that for playing on the actual server you would need to pay but there are many fan sites out there which host Ragnarok for free.


If you need a list of free fan sites, just ask again.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

can do what

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

thermodynamics -> Calories

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Bleh..323.5 after 10 tries.
[IMG]http://img154.imageshack.us/img154/9607/untitlednb7.jpg[/IMG]

Yay...:D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Bleh... what you are saying Mr. Iamthwee makes no sense at all.

This is a suggestion for providing a new shortcut (like CTRL + B) specific to Daniweb and not a query on his part....After all this is community feedback :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there Steve, welcome to Daniweb.

Looks like even you are a metal fan like me :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Well we have got Mr. Tgreer who is a professional poet, isn't he ?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

something to look

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

system -> system of a down

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Correct English speaking is a matter of practice

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

How is such..

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hospital is the last place I would wanna go

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hopefully it's just puppy love :p

Whoa...I sometimes really wonder where you come up with all these links from...I mean a link which relates to each post is too good....:D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Okay here is a simple solution which I have got verified so it should work out to be fine for any length strings...

#include <stdio.h>

void remove_s( char str[] )
{
    while( *str != '\0' ) {
        if( *str == 's' || *str == 'S' ) {
            remove_s( ++str ) ;
            // after returning from the function don't continue with loop
            // this is to avoid the destruction of counter position
            break ;
        }
        else {
            ++str ;
            if( *str == '\0' )
                return ;
        }
    }

    --str ; // take into account the increment which had occured

    // now its a simple thing of shifting chunks
    while( *str != '\0' ) {
        *str = *( str + 1 ) ;
        ++str ;
    }
}

int main( )
{
    char str[] = "She will be a massless princessi" ;
    printf( "\nThe old string: %s", str ) ;
    remove_s( str ) ;
    printf( "\n\nThe new string: %s", str ) ;

    getchar( ) ;
    return (0);
}

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

a single swipe

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

toys -> toy story

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

tantrum -> kids

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Methinks that we just end up wasting our time doing nothing when we could have made the Doom IV :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Computer is my life and soul

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I have decided that I need a break from this site and have chosen to move on with my life.

*ahem* Something tells me that one does not move on with life just because of the posting problem...;)

But still, I would like to hear from her what caused her to make this decision.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Therefore, I would recommend you use something like this:

if(strcmp(arr, arr[j]) < 0)

rather than this:

if(strcmp(arr, arr[j]) == -1)

Yes I would ask you to compulsorily make the change.

Normally the strcmp( ) returns -1 , 0 or 1.

Try out this program:

#include <stdio.h>
#include <string.h>

int main( )
{
    // all return -1 on my compiler
    printf( "The ans is %d", strcmp( "ABCD", "abcd" ) ) ;
    printf( "The ans is %d", strcmp( "abcc", "abcd" ) ) ;
    printf( "The ans is %d", strcmp( "abcb", "abcd" ) ) ;

    getchar( ) ;
    return 0;
}

But the documentation states that it returns a value lesser than 0 when the first string is less than the second string so you are better off using the < operator rather than comparing for -1.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

LOTR for me...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

death blow which..

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

healthy -> diet