Rashakil Fol 978 Super Senior Demiposter Team Colleague

If it's C, you shouldn't be compiling it as C++.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

The one you got first.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I've never seen a double posted thread.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

TeX is a typesetting system.

Yes.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You're declaring your main function wrong. Another problem is the compiler you're using.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Yes, it is hard to find. I can't see it anywhere on this thread's page. You need to have it clearly visible on every page. People probably usually find the site by visiting a search engine, reaching this forum, and not finding their answer. You need a New Topic button for these people. Clearly visible, at the top and bottom of the page.

Ever notice how sometimes people reply to old threads with new questions, that are slightly related? I noticed this happening on some threads which are search-engine prominent. (One is on the first page for 'time complexity' on Google.) These are people who came and couldn't find the new thread button.

How many do you think gave up after they couldn't find the new thread button, instead of giving up by replying to the current thread?

Advertisement: front page

Rashakil Fol 978 Super Senior Demiposter Team Colleague

ANSI C allows 15 levels of nesting but some compilers evem allow more

Bah, now I'm angry. Fortunately, Hell has probably frozen over by now :-) (http://en.wikipedia.org/wiki/Hell,_Michigan)

Rashakil Fol 978 Super Senior Demiposter Team Colleague

When it comes to a beginner's book on C++, there's only one choice: Accelerated C++ by Andrew Koenig and Barbara Moo.

Seconded.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

[tex]Oh this is awesome!

Testing...[/tex]

Okay, I guess it's stuck in math mode.

[tex]Testing...$ testing testing $testing....[/tex]

maybe?

[tex]Testing...\text{\huge{a text portion}}...testing...[/tex]

Some more testing...

[tex]\int_1^n \frac1x dx[/tex]

And some more...

[tex]\frac{\left(\frac{1 + \sqrt 5}{2}\right)^n - \left(\frac{1 - \sqrt 5}{2}\right)^n}{\sqrt 5}[/tex]

[tex]\text{\huge{\(\frac{\left(\frac{1 + \sqrt 5}{2}\right)^n - \left(\frac{1 - \sqrt 5}{2}\right)^n}{\sqrt 5}\)}}[/tex]

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I am trying to find out who is the most hated out of a list of things i hear ppl complaining about..

No you're not.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Then don't do it that way. Match only single words, and take the array of single words and work with that. If you're worried about in-between characters, and only want a single space between, do another match for contiguous strings of non-word characters, and then you're set to write some code that ties things together.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

That's not your code; it doesn't output anything at all.

While doing a global search, Perl continues just after the end of the previous match.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

If there is a built-in limit in the C++ language, then hell is frozen over. There are practical issues -- you don't want to run out of memory or with two billion nested loops, each having its own counter variable, but the restriction there isn't from nested for loops, it's from other externalities.

for (;;) {
for (;;) {
for(;;) {
... 2 billion times ...
for (;;) {
    goto end;
}
... 2 billion times ...
}
}
end:

This should be valid C++ code, and if your compiler can handle it (good luck!), and handle it smartly (haha), it should have no memory usage at all.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

They're right; it's a lot of theory. You should still study computer science for what you want. (I don't know whether this recommendation comes from my honest assessment of your situation or my desire to sic theoretical classes onto unsuspecting victims.)

-- Web Programming (Web Development using PHP, ASP, .NET, etc)

These won't be taught except maybe in some specialty course. You should be able to learn these on your own, anyway. (PHP is a crappification of C++, and ASP and .NET use some programming languages that are similar to ones you'll probably be using in getting a CompSci degree.)

-- Software Programming (Video Games using Direct3D, OpenGL, C++, etc. Also regular application programming

Once I hear 'video games', even though I doubt that's what you'll be doing when you graduate, I have to say go into Computer Science.

I think the most important thing, though, is not your degree, but how hard you work and how smart you make yourself.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Think harder.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Hi; welcome to Daniweb. While most people here try to be accomodating when others post in a foreign language (though I don't speak for everybody else), it's usually advisable to post in English. You'll probably get more and better answers if you post in the language everybody's using. You can use online translation software (http://www.google.com/language_tools?hl=en) to get a pretty reasonable result.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Only part of your post made any sense, but who cares? Welcome to the community!

Rashakil Fol 978 Super Senior Demiposter Team Colleague

The way I explained is the simple way; a complete answer takes only one sentence. "Count the number of fundamental operations that take place" is much simpler and less nerdy than any complicated description about iteration counts and nested loops.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Sure, that's how everybody solves the problem, but that sort of explanation lacks clarity and makes out the process to be some sort of magic voodoo.

Besides, you're really doing the same thing I explained, only you're calculating the algorithm's complexity via the route O(1) * O(n) + O(1) = O(n), substituting big O notation a bit earlier.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Count the total number of fundamental operations the algorithm performs, relative to some value N. For example, this function..

int factorial(int n) {
    int ret = 1;
    while (n != 0) {
        ret *= n;
        -- n;
    }
    return ret;
}

The function sets the value of ret to 1. This is one operation.

Then this function tests the condition of the while loop exactly 1 + n times. It runs the body of the while loop exactly n times. The body of the while loop performs exactly 2 fundamental operations: 'multiply ret by n', and 'decrement n'. The condition has one fundamental operation, comparison. Calling the function counts as a fundamental operation, too.

So we have the total number of fundamental operations being
1 + 1 + (1 + n) + 2 * n. (The sum is composed of the operations for calling the function, setting ret = 1, performing a total of 1 + n tests in the condition of the while loop, and a total of 2 * n operations in the body of the while loop.)

This simplifies to 3 + 3 * n fundamental operations, which is O(n).

(What do I mean by 'fundamental operation'? Any operation that takes an amount of time that is bounded by a constant.)

Rashakil Fol 978 Super Senior Demiposter Team Colleague

OOOOOOh....you'll be listening very soon from someone

Good call!

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I'm guessing he used some plugin or something with Microsoft Word.

Another way is to use LaTeX, and he might have used that, but the font and size of the integral signs doesn't look right.

One easy way, without installing software, is to use Wikipedia. Click an edit button on this page and you can use Wikipedia's math notation feature -- you can preview your changes and save whatever images you see of your notation.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Can anyone give me examples of what "Canned" software is? Is it software like MS Works or MS Office or is it more like MS Access and MS Excel type off the shelf programs?

All those you listed are canned.

Some examples of uncanned software would be a department of the U.S. government hiring Lockheed Martin to design and build a smart internal search engine, or you hiring a company to customize a Web front-end to your company's needs.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

This has got to be the weirdest reply I've read.

Umm newbie here... just want to know what basics do i must know in order to become a computer engineer... im in my 2nd yr college now and studying about networking.... And i dont understand a single thing... except making cables such us roll over cross over and straight... But thats all.. thats all i can understand... I know this is not enough for the year im in right now... i want to be an engineer... what things i must learn?
Whatever!!! im just confuse......... :sad:

Don't worry about English grammar, since if it's not your first language, and if you can communicate your point (your writing is easily clear enough for me to understand), then it's fine.

What are you doing right now to help you learn? You might not be trying hard enough (I'll assume you are :-)), or you might be better off learning in different ways.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I don't think so. What is generally called a character encoding, they call a Character Encoding Scheme. See http://www.unicode.org/glossary/. And their definition of Coded Character Set would characterize Unicode nicely. Their glossary doesn't give a definition of character encoding, probably because they've avoided using the term because it's sometimes used in different ways. I would not call a numbering of a series of characters an encoding.

To say that "Unicode is just an encoding" is misleading, because "character encoding" normally refers to the storage specification, such as UTF-8 or UTF-16BE. This is how the term is usually used, and their FAQ goes against the norm. (I'm basing what I call the 'norm' from looking at the View > 'Character Encoding' menu in Firefox, the 'Encoding' menu in I.E., and just about every link I've looked at in a Google search for 'unicode character encoding'.)

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Unicode is not an encoding, the actual storage specification is the character encoding. Unicode is more accurately described a coded character set.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Maybe they were speaking of average case efficiency, not worst case. You have 'random' insertions and deletions. On any deletion the probability that the minimal element is deleted is 1/n, assuming elements are distinct, where n is the size of the list. Then it only takes O(n) operations to scan through the list and recompute the minimal element. On average, this will be an O(1) cost per deletion.

(It would help to have more details about the question. How are elements 'added' or 'deleted' from the list? If the list is used like a stack or queue, with insertions and deletions on the ends, it is certainly possible to keep track of the minimal element in constant time.)

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I need to evaluate the definite integral from 1 to 2 of 5/(8)(x to the 6th power) dx. From my notes from years ago, I know the answer is 31/256, but I keep coming up with 29/256.

Rewrite this as (5/8)*x^(-6) (where ^ is an operator indicating exponentiation). Then an antiderivative is (5/8)*(x^(-5)/(-5)) = -x^(-5) / 8. (I've omitted the 'plus C' that is usually written.) Then -(2)^(-5) / 8 - -(1)^(-5) / 8 = -1 / (32 * 8) + 1 / 8 = -1/256 + 32/256 = 31/256.

I'm also trying another problem...the definite integral from 4 to 9 of the function (t-3)/(the square root of t) dt. I don't show that as one of the problems I worked previously, so again I don't have my notes. I keep coming up with 55/18, when the answer should be 20/3. I believe my errors occur when raising the denominator portion of the function.

I'd begin by rewriting: (t - 3) / sqrt(t) = (t / sqrt(t)) - 3 / sqrt(t) = sqrt(t) - 3 / sqrt(t). Then I'd split this into two integrals.

The integral of t^(1/2) from 4 to 9 is 38/3, and the integral of 3 * t^(-1/2) is 6. Hence, the integral of t^(1/2) - 3 / t^(1/2) from 4 to 9 is 38/3 - 6, or 20/3.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Over.

The End.

codeorder commented: :D +0
Rashakil Fol 978 Super Senior Demiposter Team Colleague

Even if we evaluate from the right for j=1 the expression will be evaluated like 1 + 3 + 3 and will still turn out to be 7.

You have no guarantee of when the increments happen. They could happen in the middle of the expression (as when you evaluate left-to-right or something), or they could happen after, or whenever. (k = j++ + j++) might be treated equally as either k = j + j; j += 2; or k = j; j += 1; k += j; j += 1; You need to separate your expression into multiple statements. For another example: Is y[i] = ++i; equivalent to y[i] = i; i += 1; or y[i + 1] = i; i += 1; ?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I am having this problem with precedence of operators. Its with the increment and decrement operators.

int i,j=1;
i=(j++)+(++j)+(j++);

this evaluates to 6 instead of 7 . Why does this happen. It would be of great help to me.
Thanks,
comwizz

It looks like you're expecting the expression (j++)+(++j)+(j++) to be evaluated from left to right. The C standard does not require this. Because you are modifying your variable j more than once in the same expression, the behavior is undefined.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

You are trying to assign something of type Node** to something of type Node*.

Node *temp;
	temp = array;

Here, you're acting like the value 'array' is of type Node*. But as you've said, it's actually an array of node pointers. (To speak precisely, it's a pointer to an array of node pointers.) This means that array should have type Node**. (I can't see how you've declared it.)

array = new Node*[k];
	Node *temp = array;

Here is a very good example of your problem. The expression new Node*[k] has a return value of type Node** . I don't know what type you've given array , but at any rate, you're trying to assign the value to temp, which is of type Node* .

A typing error such as this indicates you probably have an error in your logic, too.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Please put your code in CODE tags in the future, on any forum.

for ($i = $l; $h;  $i++)

This loop will terminate when the middle expression evaluates to a false value. You seem to want $i <= $h, not $h. ($h will just return something like 2 or 3 (whatever its value is), every time, and those are true values, causing the loop to run infinitely.)

Rashakil Fol 978 Super Senior Demiposter Team Colleague

questions 3 and 13 are identical. Both questions use undefined behavior of data overflow, so results will also be undefined.

They are not identical. (And I'm not telling you why! Nya ha ha!) :mrgreen:

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Write a C++ program without using any loop (if, for, while etc) to print numbers from 1 to 100 and 100 to 1;

puts("5 9 2 37");

These are all numbers from 1 to 100 and 100 to 1, and I'm printing them.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I'm not aware of any GNU compiler or interpreter for Ruby. You can get the Ruby interpreter at <http://www.ruby-lang.org/>. You may redistribute the interpreter under the GNU General Public License.

Ruby is a well-designed language. If you ask me, the Ruby language is better than Python's.

Also, there is no need to post this in multiple forums. This thread will hopefully be merged with the one in the Legacy and Other Languages forum.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

i have atextare in my form. when i fill the text are with this suppose "article's"
after submission of the page send it o databse .
when i try to retrive from tahe databse
i get
artice/'s. why i am getting / . pls any body help

You probably mean \, not /. *Crystal Ball Mode*: You're using PHP, and it is magically adding slashes, due to the way it's set up, resulting in slashes being added one too many times.

Or should I translate this into your language?

u probably mean \ not /
your using Php .it is magicly ading slshes, due to setup
reslting in
slash being adde eon to money times.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Any funny comment you care to share?

You weren't asking me, but meh. Here's a good one: I got called "Stupid muslim terrorist." in regard to this)

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Im trying to define a function seg, which is supposed to take a finite list xs as its argument and returns the list of all the segments xs. What is meant by a segment, is a list of adjacent elements i.e.
seg [1,2,3] = [[1,2,3], [1,2], [2,3], [1], [2], [3]]

I would have guessed that the correct output should include [] as a segment.

cons :: Int -> [Int] -> [Int]
cons x l = (x:l)
seg :: [Int] -> [[Int]]
seg [] = []
seg [x] = [[x]]
seg (x:xs) = (map (cons x) (seg xs)) ++ seg xs

This code looks more like the code that produces all the subsets of a list. The code that produces all the subsets of a list is

subsets :: [a] -> [[a]]
subsets [] = [[]]
subsets (x:xs) = map (x:) (subsets xs) ++ subsets xs

after all. Look closely at your last line. Does mapping the function (cons x) to the results of (seg xs) produce continuous segments? I'd think you'd only want to prepend x to the segments that begin at the beginning of the list xs. I recommend using a helper function for this.

As you have it, seg [1,2,3] results in (map (cons 1) (seg [2,3])) being called, and since [3] is a segment of [2,3], this results in [1,3] being given as a segment.

Can you please email optimak@gmail.com to let me know, or do …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I read this complicated theory before. I downloaded Perl from their Web site and Java from Sun and Apache. I written and ran few examples also. Please explain.

Perl is the name of a programming language. Java is the name of a programming language.

"Java" is also the common name of an interpreter distributed by Sun that runs compiled programs written in the Java programming language.

Programs written in the Perl programming language are interpreted by "perl," which is a Perl interpreter. This is not the only Perl interpreter, though. There's a Perl 6 interpreter known as "Pugs."

[Edit: Ack, sorry for the double post.]

Rashakil Fol 978 Super Senior Demiposter Team Colleague

I thought Perl is CGI? I can run a Perl script and rename it with .pl or .cgi extension; it doesn't matter! Do, I rename my C++ program as .cgi? How can it run online .. :!:

Please help me: I'm very much confused .. (I knew now .. I remained confused all the time, in the college also ..)

CGI stands for Common Gateway Interface. It's not a programming language; it's a way by which web servers (such as Apache) communicate with server-side programs. These programs can be written in any language, such as Perl, Python, C++, and Lisp, and they can be interpreted or compiled. The web server sets some environment variables and starts up the program, possibly sending some information through standard input, and the program writes the HTTP response, with HTML or maybe an image, to standard output.

For example, here's a tutorial called Getting Started with CGI Programming in C, though I wouldn't recommend using C or C++ as a first choice for CGI programming.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

It looks like a fine implementation of the behavior of the Scheme function, LIST?. I don't know why you'd use (and t (isList (cdr list))) when that means the same thing as (isList (cdr list)) .

However, Common Lisp (I'll assume that's the variant you're using, since you didn't specify) has a different meaning for listp.

listp object

listp is true if its argument is a cons or the empty list (), and otherwise is false. It does not check for whether the list is a ``true list'' (one terminated by nil) or a ``dotted list'' (one terminated by a non-null atom).

Rashakil Fol 978 Super Senior Demiposter Team Colleague

what do you mean by epsilon

in the code (abs(divisor-quotient)>=epsilon)

For some inputs, you're never going to get divisor == quotient to come out true. You need to test if they are sufficiently close. E.g. if they are less than epsilon distance apart, where epsilon is some small number, such as 0.000001

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Due to precision limits in floating point approximations, you are running into cycles where the quotient flops back and forth between two very close approximations.

Instead of testing (divisor != quotient) and (divisor == quotient), you need to see if they are sufficiently close, e.g. test (abs(divisor - quotient) < epsilon), or (abs(divisor - quotient) >= epsilon).

If this a homework assignment, I bet you're supposed to let epsilon be 1/(10^tolerance)

Rashakil Fol 978 Super Senior Demiposter Team Colleague

hello everyone
i was trying to make my own own string concatenation function but wasnt able to do so. i need ur help.

What don't you understand that prevents you from doing this? What do you think would be a subroutine that does work?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Gandhi?

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Ok. I am trying to write a perl program to automate installation of certain softwares (as root) on a linux machine. I want my perl program to call an installation script and provide parameters to that script such that I do not have to enter 'yes', 'no', 'continue', create directory?', etc, from the command line. I want to fully automate the installation process without much user interaction via keyboard. I need help. Thanks

To call another program with parameters, you will want to pass a list of parameter strings to the 'system' function.

E.g.

system "cp", "foo", "bar";

See http://www.unix.org.ua/orelly/perl/prog3/ch29_02.htm#INDEX-5326

Rashakil Fol 978 Super Senior Demiposter Team Colleague

can anyone please explain me in simple words about induction and how to use induction to prove something.

Sure. Take a proposition, i.e. a statement that can either be true or false. For example: "For all positive integer values of N, the sum of the first N odd numbers equals N*N."

This can be divided into a set of sub-propositions:
"The sum of the first 1 odd numbers equals 1*1."
"The sum of the first 2 odd numbers equals 2*2"
"The sum of the first 3 odd numbers equals 3*3."
and so on.

Just for the sake of syntax, let's let P(N) represent the proposition, "The sum of the first N odd numbers equals N*N." I.e.
P(1) = "The sum of the first 1 odd numbers equals 1*1."
P(2) = "The sum of the first 2 odd numbers equals 2*2."
P(3) = "The sum of the first 3 odd numbers equals 3*3."
and so on. Each of these are 'propositions', remember, which can be proven either true or false.

Proof by induction is in two parts:
Step 1. Show that your "base case" proposition is true. That is, show that P(1) is true.
Step 2. Take some value M. Show that if the proposition P(M) is true, then the proposition P(M+1) is true.

Let's do this for the above example. First, we follow step 1, which means we need to show that P(1), the statement, "The …

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Is anyone familiar with lisp programming? If so can you please respond back. I have a program due and it deals with lisp type checking! I would really appreciate it. ;)

I am.

Rashakil Fol 978 Super Senior Demiposter Team Colleague

Here is the solution to the GIF posted before.

4 8 1 5 6 7 3 9 2
1 6 3 2 7 8 4 5 9
8 5 6 1 2 9 7 4 3
9 4 5 8 1 3 2 7 6
3 7 4 9 8 6 1 2 5
2 3 9 7 4 1 5 6 8
7 9 8 4 5 2 6 3 1
5 1 2 6 3 4 9 8 7
6 2 7 3 9 5 8 1 4

This solution was formed by performing row and column swapping operations until each number possessed its own 2:30 - 7:30 diagonal. (There are nine diagonals; they wrap around.) Then these numbers can be slid up and down their diagonals to fill the whole matrix with numbers. This produced a matrix of

5 1 6 2 3 7 9 4 8
1 6 2 3 7 9 4 8 5
6 2 3 7 9 4 8 5 1
2 3 7 9 4 8 5 1 6
3 7 9 4 8 5 1 6 2
7 9 4 8 5 1 6 2 3
9 4 8 5 1 6 2 3 7
4 8 5 1 6 2 3 7 9
8 5 1 6 2 3 7 9 4

Then I performed the same row and column swapping operations, in reverse order, to bring the nine digits to their original positions, giving the solution matrix.

The algorithm is simple once you maneuver every number to its own diagonal. But maneuvering numbers to diagonals is the tricky part. I think it can be done given any input, but I'm not sure what a general algorithm would be. Not many swaps are needed. I used seven in the above problem.