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

specs

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

the very best

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

Falls apart - Hurt

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

Immortan bunny-rabbits with Baldur's sword began improving their fighting skills while attempting to amaze miss Piggy.

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

I drive on a road to hell.

I put in some Mozilla plugins.

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

Never ever again think, nothing essentially super sucks.

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

But if you still want to use delete (which would be a good thing), consider dynamically allocating the vector using the new operator.

iamthwee commented: silly, vectors don't need dynamic allocation using new. -2
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The last else in the getChar() function has no return statement, that's what the warning is all about. It is always a better choice to set the return variable in the condition and return that at the end of the funciton. Something like this:

// Untested
char getUserChoice ()
{
  int again = 0;
  do {
    char x = '\0', result = '\0';
    cout << "Please enter Rock, Paper, or Scissors: ";
    cin >> x;
    cin.ignore(1000, '\n');
    x = toupper(x);
    if (x == 'R') {
      result = 'R';
    } else if (x == 'P') {
      result = 'P';
    } else if (x == 'S') {
      result = 'S';
    } else {
      again = 1;
      cout << "Not a good choice. ";
    }
  } while (again);
  return result;
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Its a pity I haven't as such got any practical experience with J2ME. Maybe skimming through the following pages would help you in getting what you are looking for.

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

> Who'd have thought it would create such a discussion ?

WOW...I thought what he posted was not meant to be read. Whod of that it would bud such a pst. ;)

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

Ah..so nice of you. ;-)

Now we just need to convince the remaining 160k members to join our cause and the world would be ours... :D

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

> Whatever works for you... (wait, you weren't being sarcastic were you? :p
Oh my, I really have got intelligent people as my friends... :-)

But yes, if given an option like the one you mentioned, I would definately like to try out different font and size combinations.

PS: BTW, whats up with all the darkness... ;-)

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

These free books would be good if you into compiler design.

As for data structures, go to this page and read the reviews of different books. That should give you an idea of how good a book is.

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

Your classpath is not set, thats why it throws ClassNotFoundException. Make sure you set your classpath properly and do read the tutorials on Sun's site.

Here is one of them.

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

Thank you Joey, maybe now I would be able to view each and every site in my favourite font -- Slyfaen. :-)

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

...*checks the title of the thread and wonder what these people are talking about...*

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
// yourheader.h
#ifndef _a_yourheader_included_
#define _yourheader_h_included_
class A
{
   B m_b;
   C *m_c;
   D *m_d;
  
public:
  void SetC(C *c);
  C *GetC() const;
  
  void ModifyD(D *d);
};
#endif

/************************************/

// yourcpp.cpp
void A::SetC(C* c)
{
  m_c = c;
}

C* A::GetC() const
{
  return m_c;
}

void A::ModifyD(D* d)
{
  d->SetX(0);
  d->SetY(0);
  m_d = d;
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The application looks good as such. Hope you get the summer placement in your company. Best of luck. :-)

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

Maybe you should post it here for all those people who are with you on font change... ;-)

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

> Thanks I will take your advice. I guess you guys have never needed help huh?

Yeah right, we never needed help, we worked hard to earn it....THrowing smart questions around won't get you much help anywhere.

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

I could basically pwn most people on this page in terms of posts...

*Cough* :-)

Post count is not a race. It stands for nothing. Rep is what matters.

No, I don't think so. Even though I have a bit of rep, IMHO, I don't think its the rep that matters. Its what you know you have done for the forum as well as what the members of Daniweb think about you that matters in the very end....

I've seen some forums where post count is a good indicator of how much work someone has done in the forums, but DaniWeb is certainly not one of them.

Good thing I show my face in the tech forums now and then... :-P

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

[tex]2 * 2 * 2 = 8[/tex]

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

New start of game:

[tex]2^2 = 4[/tex]

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

Here you go...And please type proper English, its difficult to understand your posts.

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

Something like this ?

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

Isn't an array of 3 integers of 4 elements each?

Nope, the dimensions which we specify at the time of declaration/definition are the actual dimensions of the array. Their indexing is 1 off of the dimensions.

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

For on the fly sparse arrays, you can try something like:

#include <iostream>

int main()
{
    using namespace std;

    const int ROWS = 3;
    const int COLS = 4;

    double** dArr = new double*[ROWS];
    for(int i = 0; i < ROWS; ++i)
    {
        dArr[i] = new double[COLS];
        for(int j = 0; j < COLS; ++j)
        {
            dArr[i][j] = i * COLS + j;
        }
    }

    for(int i = 0; i < ROWS; ++i)
    {
        for(int j = 0; j < COLS; ++j)
        {
            cout << dArr[i][j] << "\t";
        }
        cout << '\n';
    }
    cin.get();
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

[tex]22 * 3 + 600 = 666[/tex]

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

You should try out something like this though you should know in advance that it would quickly turn out to be ugly in case you don't have the required knowledge of C++/WinAPI.

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

> Give it time, people will get use to it
In other words ingore the ones who strive for a better Daniweb....

> </totally meaningless post>
You forgot the opening tag Joey, sorry your post doesn't comply with the standards... :D

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

To fix that, you should put the random generator in a loop and use the LinearSearch results as a loop condition:

for(int i = 0; i < MAXSIZE; i++)
{
  do {
    temp = rand() % 5000; // get random number
  } while (LinearSearch(list, temp) != -1); // repeat till it's unique
  list[i] = temp; // save it
}

• The loop counter in the loop which generates random numbers should not be incremented if a duplicate in found in the list.

;)

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

Go Walt !! Go for it. :-)

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

Some points:

• You need to tell us a bit more than the normal "this doesn't work" thing. What do you mean when you are not able to generate unique numbers? Is the array not filled completely or the numbers are getting repeated.

• You need to break out of the loop in your linear search if the required value is found.

• The loop counter in the loop which generates random numbers should not be incremented if a duplicate in found in the list.

• Use the current time as seed instead of a small number like 7 or 12.

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

*shrugs* I guess its just me. Also considering no other Programming Forum Mod or member has raised an issue, its OK with me.

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

Don't know why but the current post font and code font don't mix quite well, it just takes away the focus from the code. Still this kind of setup would have make the code look quite good.

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

Why not add scroll bars to the source code pasted so any change in size wouldn't affect the overall layout ?

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

You get someone who doesn't like to Google.. ;-)

I put in Eclipse.

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

Immoral slackers of Baldur's gate began improving their marketing while attempting to kiss miss Piggy.

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

Here is formatted code:

#include <iostream>
#include<iomanip>
#include<string>
using namespace std;
struct DaysStruct
{
    int month;
    int st_date;
    int end_date;
    DaysStruct(int i,int e)
    {
        st_date = i;
        end_date = e;
    }
}
;
struct BaseStruct
{
    int date;
    int end_date;
    double snow_depth;
}
;//Function prototypes
void calcDays(DaysStruct[],BaseStruct[],int);
void sortbyBase(BaseStruct[],int);
void showOrder (BaseStruct[],int);
int main()
{
    const int NUM_DAYS = 7;
    DaysStruct days[NUM_DAYS] = { DaysStruct(12),
                                  // days[0] = st_date; DaysStruct(13),
                                  //days[1] = days[0] + 1; DaysStruct(14),
                                  //days[2] = days[1] + 1; DaysStruct(15),
                                  //days[3] = days[2] + 1; DaysStruct(16),
                                  //days[4] = days[3] + 1; //days[5] = days[4] + 1;
                                  // days[6] = end_date;
                                  DaysStruct(17), DaysStruct(18), };
    BaseStruct base[NUM_DAYS]=
        {
            cout<< " Enter the seven base snow depths", cin >> base[0],base[1],base[2],base[3],base[4],base[5],base[6],base[7]
        }
        ;
    calcDays (days,base,NUM_DAYS);
    sortbyBase(base,NUM_DAYS);
    cout<< fixed << showpoint << setprecision(2)
    ;
    showOrder(base,NUM_DAYS);
    system("PAUSE");
    return EXIT_SUCCESS;
}
void calcDays(DaysStruct days[],BaseStruct base[],int num)
{
    for(int index=0; index< num; index++)
    {
        base[index].st_date = days[index].st_date;
        base[index].end_date = days[index].end_date;
        cout<<"Enter the month"<<endl;
        cin>>month;
        cout<< "Enter the starting date of the 7-day period"<<endl;
        cin>>st_date;
        cout<<"Enter the ending date of the 7-day period"<<endl;
        cin>>end_date;
    }
    void sortbyBase(BaseStruct base[], int elems)
    {
        int startScan,maxIndex;
        SalesStruct maxValue;
        for (startScan = 0; startScan< (elems-1); startScan++)
        {
            maxIndex = startScan;
            maxValue = base[startScan];
            for ( int index = startScan+1; index<elems; index++)
            {
                if (base[index].snow_depth > maxValue. snow_depth)
                {
                    maxValue = base [index];
                    maxIndex = index;
                }
            }
            base[maxIndex] =base [ startScan];
            base[startScan] = maxValue;
        }
    }
    void showOrder(BaseStruct base[], int num)
    {
        cout<< "Date \t \t Base \n";
        cout<<"-----------------------------\n";
        for( …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Mel, what do you think about the size of code snippets are compared to the normal text? Don't you think even that ought to be changed along with the normal text.

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

Yes I agree, treating the array which I created as being contiguous would be a mistake. The code snippet was just meant to correct the OP's typo.

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

Immoral slackers of Linux gate began improving their marketing while confusing to kiss miss Piggy.

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

> But the op said his separators were only one char. In any case that
> doesn't matter. You could fix that easily.
Fixing your code which uses StringStreams for working with more than one characters would not be a trivial task. It would then involve getting knee deep into all the STL jargon.

> The OP is getting his work done with no effort from himself...Bah
:@ ;-)

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

Your code won't work when the delimiters are more than one character. Also my program returns a pointer to a dynamically allocated vector, with the elements as string pointers so there are as such, no vector duplicates like AD said.Though its not the best solution one could come up with, its not that bad either considering was hacked in 10 minutes, for free and without bad programming practices... ;-)

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

Something like this?

public class Test 
{
    public static void main (String[] args)
    {
        String str = "HellO THIS is @#@%@ a M*#ED string";
        int length = str.length();
        int upperCount = 0;
        int lowerCount = 0;
        int punctCount = 0;
        int digitCount = 0;
        int whiteSpaceCount = 0;

        char ch = ' ';

        for(int i = 0; i < length; ++i)
        {
            ch = str.charAt(i);
            if(Character.isUpperCase(ch) == true)
                ++upperCount;
            else if(Character.isLowerCase(ch) == true)
                ++lowerCount;
            else if(Character.isDigit(ch) == true)
                ++digitCount;
            else if(Character.isWhitespace(ch) == true)
                ++whiteSpaceCount;
            else
                ++punctCount;
        }
        System.out.println("\nUppercase: " + upperCount + 
                            "\nLowercase: " + lowerCount +
                            "\nDigits: " + digitCount +
                            "\nWhitespaces: " + whiteSpaceCount +
                            "\nPunctuation: " + punctCount);
    }
}

Uppercase: 9
Lowercase: 12
Digits: 0
Whitespaces: 6
Punctuation: 7

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
public void run() { 
 
for (int i = 1; i >= 1; i++) {
System.out.println("Thread " + getName() + i);
}

What is the for loop supposed to do? For all I can see, it gets executed only once. Is this what you wanted? Maybe an infinite while loop would be more like it:

while(true)
{
    System.out.println("Thread: " + getName());
    Thread.sleep(1000);
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get youPhone.

I put in Putin.

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

aces high - Iron Maiden

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

potentia

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

Cow has nothing