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

Try this suggestion:

I just had a problem with a user trying to run Borland C++ 5.02 on a Windows XP Pro computer in a non-privileged account. She would get a message box "Make failed", and in the Message window:

Could not load: tlink.exe

One of the reasons why this can happen is if BC5 is installed under "C:\Program Files". This can cause all sorts of problems. Instead just install it under C:\BC5.

However, there is a second problem: The IDE tries to create a file named C:\$$PIP$$.$$$ to communicate with tlink.exe, but non-privileged users are not allowed to create files in C:\! Here's the solution:

1. Create C:\$$PIP$$.$$$ from an Administrator account
2. Open Properties|Security, select the Users group and click the [Advanced] button.
3. Select the Users group again, click the [Edit] button
4. Click "Full Control" in the "Allow" column and "Delete" in the "Deny" column.
5. Keep clicking [OK] and [Yes] to close all dialogs.

This ensures that all users can write to C:\$$PIP$$.$$$ and at the same time keeps them from deleting it, because the permission to write to the file would be lost if the file were deleted.


BTW, you'll probably want to create a directory such as C:\PDEV (like "Program Development") for hosting your projects, because BC5 may have problems with path and file names that don't follow the old 8+3 convention. You can get BC5 to open in that directory by default by editing C:\WINDOWS\BCW5.INI.

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

When you use the array name in value context, the compiler actually converts it to a pointer to the first element. This is only the array name though, the array itself is never a pointer.

Isn't this self explanatory?

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

I have to admit this thread is one of its kind. We don't get to see such things everyday. I must admit that one more question and you would force Narue into giving you an infraction. I can imagine her banging her head on her screen at this very moment. ;-)

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

He didn't really mean it.

As far as program is concerned, read this, this and this.

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

why here the const is droped? can you explain it more specific here?

this is a feature of C and C++ to cater for old code.

This is the part of the agreement the compiler has to follow or to allow. If it makes you happy, think of it as a feature which the standard mandates.

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

Which OS are you on and how were you trying to execute the program?

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

char* str = "Literal"; Though the above is a constant string literal, nothing prevents you from modifying it. The compiler has no way of enforcing it at compile time. To make the compiler know that this is a string literal which shouldn't get modified, we write: const char* str = "Literal"

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

Print the entire array in main() after accepting user input and see if it is printing out any records, which it definitely should.

And why pass the variable 'i' when you can declare it as a local variable in the function itself. Passing it around won't serve you any purpose, will it?

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

The thing you experienced is also known as Short Circuit Evaluation. If you want to find a way around it, try using the logical version of Bitwise AND. Something like this: $ret = $ret & foo(); //notice single & This way you can be always sure that the second part is evaluated irrespective of the outcome of the first one. Though normally in such situations, the preferred way would be to place the return value of the function in another variable and use it in the real equation.

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

Right, but again it is implementation specific. The language doesn't mandate it.

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

Portability?

I thought it was ease of maintenance? ;-)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
int isPalindrome ( const char *word )
{
  std::stack<const char> mystack;
  int count = 0;

  while ( word[count] != '\0' )
    ++count;

  int half = count / 2;
  int j;
...
}

Any reason for not using strlen ? :-)

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

Using fgets for accepting input from user would do the trick. Read this.

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

Would you like to be a friend, and share with me everything that goes on in area 51? lol =)

I already am sneaking out secret data to lots of other people. You would have to catch another mod... ;-)

<shameless-plug>
> You can donate a few dollars a month for access.
</shameless-plug>

;-)

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

Nah, you can always befriend a mod... ;-)

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

Next time try a more meaningful title. I edited the current one to make some sense out of it...

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

cin and cout don't belong to C language...

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

Read this and the related articles for a better understanding of scanf.

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

*Bling* Battle apparently lost. Dani is in favor of the games. The kids get to rejoice, the ones who oppose are free to cower away.A straight end to a twisted tale.

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

Maybe this would help.

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

They are so simple they don't need an explanation. Just read about Flowcharts and Pseudocodes.

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

I dont think this works please be more specific

You need to have the Boost API installed on your system -- only then you would be able to sun the mentioned example.

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

Keep another variable outside the loop lets say grandTotal and at the end of each loop do something like grandTotal += loopTotal . Now this variable will hold the sum of all the totals. Don't forget to initialize grandTotal to 0.

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

Here is a good UML tutorial.

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

Create a project, open a new file in that project, write your program, press the compile and run button somewhere at the top and you are good to go. That's it !

Which step are you specifically stuck at?

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

You would be required to have an array of the size the same as the range of numbers to be generated. For eg. as in your case, the range is 5, hence create an array of 5 elements, and for each random number generated, do something like:

int frequencyArray [RANGE] = { 0 };
random_integer = int(6 * rand()/(RAND_MAX+1.0));

// asssuming that the generated number is between 1 and 5.
++frequencyArray [randomNumber - 1];

BTW, why the need to add zero to your random number equation, which I think would also generate 0 which you don't need.

Consider doing:

srand ( static_cast<unsigned int> ( time ( 0 ) ) );
random_integer = 1 + int(5 * rand()/(RAND_MAX+1.0));
~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

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

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
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
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The point here is that, are floating point numbers absolutely necessary in your program. Can't your task be performed without floating point numbers? If you still want, you can safely pass integers to functions which accept float and the compiler will take care of the upcasting.

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

Stop using floating point variables as your for loop counter and you should be good to go.

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

No such error in my case. Which compiler are you using ? Just a thought, try keeping different variable names for the GOTO labels and your normal variables and see if that makes a difference.

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

Considering a generalized senario in which complexity for only looping constructs is considered and all other operations are considered to be performed in constant time, I don't see whats wrong with the idea...

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

You must have declared I as an integer variable while size() returns a number of type unsigned integer. Hence the warning message. Try changing the loop variable to type size_t and it should work out to be fine.

Read this.

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

Keep a counter which will be initialized to 1, fgets the entire line of text in a character array, skip the first two lines using the counter previously mentioned and start reading from the third line.

Read this for using fgets.

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

It need not necessarily be the rooting. Try to come up with any function which cuts down the range and you should be good to go. Just make sure that the function gives integer values for the elements. That way, handling the transformed values and sorting them shouldn't be a problem as such.

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

Oops.... so it is. Thanks Sannie

I guess its payback time... :mrgreen:

Not quite, it's
minimum + rand() / (RAND_MAX / (maximum - minimum) + 1 ); To ensure proper distribution.
(sorry, I couldn't help it )

Actually, according to this very enlightening read, you're all wrong...

(sorry, I couldn't help it either)

I never said my code ensured proper distribution. Atleast it was logically correct. :D

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

Not quite. it's minimum + (rand() % maximum);

Not quite, its: minimum + (rand() % (maximum - minimum)); This will produce random numbers in the range minimum inclusive and maximum exclusive.
;)

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

Nope, won't do, unless he is ready to sacrifice the real values and accept the approximates. Think of it this way, would the data before squaring and after squaring be the same? I guess no. If you know the way floating point numbers are handled by the system, you would know what I am trying to convey.

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

Your program doesn't work becuase you never assign a value to 'ch'. Try adding ch = input[i]; inside the for loop.

Oh and btw, use of global variables is a bad programming practice, avoid it. Also don't do redundant comparisions.

for(int i = 0; i < length; ++i)
{
    ch = tolower(input [i]);
    if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u')
        ++vowels;
  
   // remaining code here
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

initialize( x , y , z ) << endl ; You can't do this in C++ esp when initialize doesn't return anything and even if it did, you aren't specifying the stream to which the output should be redirected.

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

But practically speaking, a sorting algo having O(n) as its worst case would be hard to get by. I guess the only choice the OP is left with is to pick a nice O(n log(n)) algo and make custom changes to it (depending on the problem statement) to bring it down to O(n) though achieving O(n) for worst case still looks kind of impossible.

And the reason Smoothsort is rarely used is because of the difficulty faced in its implementation.

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

or else Vista...

I have used that card and it performs fairly good when running Windows XP and even high end games. Like Joey said, its some Vista thing, no graphic card suckiness.

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

Have you tried out SmoothSort ?

Its best case is O(n) and worst case is O(n log(n)) with the obvious downfall of difficult to implement.

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

Place the statement getchar() at the end of your program just before return 0 (if you have one) and then compile and run.

As for free IDE's look here.