Salem 5,265 Posting Sage

> But at the end of the run it comes up with an Debug Assertion failed.
> WHY???

In your case, you're deleting what you didn't new.

If you don't call new for a pointer, don't call delete.

Examples.

int *p = new int ; .... delete p;
int *q = new int[10]; ... delete [] q;

If you used [] in the new, then you MUST use [] in the delete as well.

Other causes of trouble
- running off the end of the allocated memory (say by using <= in a loop rather than < ) MAY cause an assertion, or a segfault
- trying to delete the same pointer twice MAY cause an assertion, or a segfault
- doing some pointer calculations, and then deleting a pointer which is no longer at the start of the memory allocated MAY cause an assertion, or a segfault

Note that just because you do something wrong, there is NO guarantee of a run-time diagnostic. The surprise can be deferred until much later on.

Salem 5,265 Posting Sage

http://clusty.com/search?query=company+formation+chennai+india&sourceid=Mozilla-search
Find a specialist company that deals with company formations.

a) it will be a lot quicker. Here in the UK, you can buy a new company off the shelf in less than 24 hours, for the cost of a mornings work on your part.
b) it will be cheaper (you can carry on earning at what you're good at, rather than spending weeks getting to grips with legalities)
c) it will probably be done right first time. You don't want to find your new company in some legal mire a few years later.

DangerDev commented: nice suggestion, specially last one. +3
Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

to post in this thread, wins.

You're already too late - losers!
I WIN!

ahihihi... commented: :D Nice thread.................. +1
Salem 5,265 Posting Sage

> main() or void main() or int main() it worked for me
Understand that there is a difference between the language and a compiler.

The language states that main returns int.

Your compiler (just one of many) is an implementation of that language. All compilers extend the language in some way, for a number of reasons.

Learn the language, and not the compiler.
Or at least learn that there is a difference, so that it is not a total surprise to you when you come to use another compiler.

yellowSnow commented: against "void main" - keeping up the tough fight +2
Salem 5,265 Posting Sage

There is a make.exe in the msys directory which is installed alongside the mingw directory.

That's where I found a make.exe anyway, though I'm not clear on what the installation steps were to get it.

Salem 5,265 Posting Sage

http://www.nondot.org/sabre/os/articles

> If any one willing to help me design a os i'll probaly find them here.
And what exactly would be your contribution?

Salem 5,265 Posting Sage

A full install of code::blocks would have installed a version of MinGW.

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

What kind of network do you have on the LAN side?

Does everything connect to your machine, and your machine connects to the internet, using ICS
http://en.wikipedia.org/wiki/Internet_Connection_Sharing

Do you all plug into a broadband router, and it connects to the internet?
http://www.homenethelp.com/router-guide/index.asp
If so, what sort is it (manufacturer / model)

> so that download can be blocked during the peak hours.
This is generally called "traffic shaping"
http://en.wikipedia.org/wiki/Traffic_shaping
Searching for that, plus any other terms which describe your situation (like your router model number) might lead to more info.

Salem 5,265 Posting Sage

well that's a bit vague.

What do you know already?
- I've heard about dev-c++ and apparently it's the thing to use
- I've written "hello world" for the console
- I've written "hello world" as a win32 GUI
- I know how to create simple classes
- I know some things about the STL
- I've done a bit of Win32 programming
- your turn

Salem 5,265 Posting Sage

Once you have the Magick++ sources available, follow these detailed installation instructions for UNIX and Windows.

Did you follow?
It mentions the .h file you seek.

Salem 5,265 Posting Sage

ImageMagick is a program AND an API
http://www.imagemagick.org/script/index.php

Command-line Tools
Processing
Options
Usage
Program Interfaces
MagickWand
MagickCore
PerlMagick
Magick++

Salem 5,265 Posting Sage

How about burning a few CD's worth of less listened to music (or unseen photos) that you might have?

If you're scratching for a few MB, then you've got bigger disk space issues.

Salem 5,265 Posting Sage

Well that's one way to screw things up I suppose.

You're stuck in a 16-bit emulation of an x86, unable to access the 32-bit goodness of your real OS or real processor.

Perhaps consider upgrading to a compiler which is actually compatible with your OS.
Then you could use QueryPerformanceCounter

As it is, you could try this

start = clock();
for ( i = 0 ; i < 1000 ; i++ ) {
  doCodeToBeTimed();
}
end = clock();

Divide the difference by 1000 to get an average per run.
Increase the number of iterations until you get an overall loop time which takes the order of seconds to complete.

Salem 5,265 Posting Sage

Source code goes in .cpp files, not .h files!

Two files include that .h file, and you have TWO copies of the same function name.
This is what "multiply defined" means - more than ONE.

Salem 5,265 Posting Sage

Using time.h to time code is like using a sundial to time a bullet.

You could use it if you're doing a lot of work (say sorting 1M integers), then time.h might work (so long as it takes several seconds).

But for anything consistently below 1 second, you need a much faster clock. However, pk09 needs to say which OS/Compiler is being used here, because there is nothing standard about how to access faster clocks.

Salem 5,265 Posting Sage

The bin version is if you just want to run the programs.

The src is if you want to actually edit the program, read what it does, figure out how it works, make changes, fix bugs immediately etc etc.

Salem 5,265 Posting Sage

Also consider the lack of usefulness of a string containing only one char (a \0)

Salem 5,265 Posting Sage

> iam doing My final project in Asp.net i have few idea that i can shre with u.
Would it be anything to do with building one of these?
If so, then use it to travel back in time so you can reply to this post in a timely manner, as opposed to several years TOO LATE.

Salem 5,265 Posting Sage

Many of the commercial coding standards I've come across insist on using braces in all contexts, even the optional braces in 1-liner statements.

If you're using a syntax-driven editor, they come for free anyway, so removing them is work.

It also prevents "Arrgg!" moments, when attempting to add debug to say

if ( i < 10 )
    i++;
    printf( "i is now %d\n", i );

Coupled with bad indentation, and something less obvious than a printf, and it could be a while before you figure it out.

Basically, if there is one way which always works, then use it always.
Then by habit, that aspect of the program will always be correct.

If you have a special case you treat differently, then bugs appear when it ceases to be a special case and you don't notice the transition.

Salem 5,265 Posting Sage

It's a nice idea.
But there are at least 6 places where code tags are mentioned, and still about 99% of noobs fail to use them on the first post. People get +ve rep just for proving they can read - it's that rare!

Some continue to fail to use code tags despite numerous reminders.

Getting any of them to do anything more than press "submit" is hard work.

Further, where threads are marked as "solved", this can sometimes happen when the OP gets the first working answer (as opposed to the best correct answer).

Nor does marking a thread "solved" mean that some dimwit will happen along a few years later with some untagged "void main" horror just to show the world how little they know.

yellowSnow commented: Yep .. good points .. just me being a tad naive +2
Salem 5,265 Posting Sage

> but i've got problems doing that and i cann't read the bitstream
Are we still on the PC using VC++ at this point?

Salem 5,265 Posting Sage

> connecting my computer directly to my modem (bypassing my router) seems to make my connection
> return back to its original state.
I take it that you're using some kind of ADSL over telco lines then?

Does making a normal phone call have the same effect as using a dial-up modem?

Does your cable modem have any kind of setup page?

Open a cmd.exe console, type 'ipconfig'
Then in your browser try connecting to http://192.168.1.1 (or whatever your Default Gateway address happens to be).

For example, I can get a page like this

Pay close attention to things like line rate, noise margins and error rates. Get to know what a "good" page looks like and compare with a "bad" page when things get worse.

Also, do you have a splitter/filter block which splits your telco line into phone and ADSL. Have you replaced that?

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

If you want to store 3.14 (and no more), then you need a different data type than a float.

You're always going to end up with either 3.139999999 or 3.140000001, depending on which is the nearest representable form to the value 3.14

Salem 5,265 Posting Sage

A lot of software is written along the lines of "You start coding, I'll go and find out what they want".

First you need a set of requirements ("What do you want?").
For non-programmers, these tend to be unfocussed and vague statements like "I want a word processor".

Your first task is to break these down into separate things you can test
- the program shall be able to load a file
- .... save a file
- the external data shall be represented as an XML document.

The next task is to produce a design ("How am I going to do it").
UML (as already mentioned) is one way of going about this.
- Think about objects (document, paragraph etc) and methods.
- Think about additional requirements such as "shall run on XP and Linux".

Imagine how say "save file" would traverse the functionality of your design. Does it actually work on paper? Keep refining it until everything does. It takes moments to fix a diagram, but it would take you weeks in the code much later on.

Next think about how you're going to implement it. What language(s) to use, what libraries to use.

~s.o.s~ commented: Excellent advice. +29
VernonDozier commented: Nice breakdown. +21
Salem 5,265 Posting Sage

Example

#include <stdio.h>

int placeShip ( int sea[][10], int id, 
                int bowx, int boy, 
                int sternx, int sterny ) {
    // checks the sea to see if a ship can be placed between
    // the stated coords
    // yes, place the ship and return true
    // no, return false and don't change the sea
}

int main ( ) {
    int sea[10][10] = { 0 };
    placeShip( sea, 1, 5, 5, 10, 5 );
    return 0;
}

Except you would call it in a loop to place a number of ships.

You would then enter another loop to
- throw shells at the sea
- determine hits
- determine sinkings
- determine a winner

Salem 5,265 Posting Sage

Just making sure you have an early dose of reality.
You think prospective employers will mollycoddle you?

Unless you can think for yourself, you'll always be stuck in your cube on a cube farm, and you'll always be expendable.

It's a choice I suppose, but you didn't really need to go to college just to aspire to that level of mediocrity.

Salem 5,265 Posting Sage

How about coming up with your own answers?

You can read all the cookery books you like, but until you've set the kitchen on fire at least once, you're never going to be a great chef!

Salem 5,265 Posting Sage

> i is an independent value and i think it's value should increase infinitely
It has to exist in memory SOMEWHERE.

The most likely scenarios are

+=========+
|    i    |
+=========+
| arr[99] |
+=========+
|   ...   |
+=========+
| arr[0]  |
+=========+

OR

+=========+
| arr[99] |
+=========+
|   ...   |
+=========+
| arr[0]  |
+=========+
|    i    |
+=========+

In one case, writing the mythical arr[100] in fact trashes i instead.
In the other case, you miss i, but probably go on to trash something else instead.

In either case, the code is trash.

Dave Sinkula commented: A picture is worth a thousand words. +24
Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

You answered it yourself.
You overran the array.
You then trashed i, and i got a new value.

There is no guarantee that the program will fail if you do anything wrong. If you want that kind of safety net, use another language.

Salem 5,265 Posting Sage

Just wondering if you felt like reading the intro threads, and HOW TO POST CODE anytime whilst waiting for an answer.

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

Are you expecting 10 to be printed by that code?

Because that would be cout << showbase << dec << [B]*[/B]p << endl; To actually output a pointer in another base, you'll probably have to cast it to something which isn't a pointer (in other words, ugly)

Maybe cout << showbase << dec << [B](unsigned long)[/B]p << endl; I'm guessing the output of a pointer representation ignores base, because the idea itself is meaningless.

Salem 5,265 Posting Sage

There's no such thing as an "array of bits" in C.

Salem 5,265 Posting Sage

Can you summarise the effect in a complete program we can try ourselves, and not just a context-free program fragment that could do anything.

Salem 5,265 Posting Sage

Allegro is a graphics library (so no).

Try the STL instead
http://www.cplusplus.com/reference/stl/vector/push_back/

Salem 5,265 Posting Sage

Good luck with that :icon_rolleyes:

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

Excellent idea - the bit about being different.

Unfortunately, you're in a large pond of other people who can't think for themselves, even after many years of education. Just take a look at all the other "final project" threads.

Salem 5,265 Posting Sage

First, this is HIGHLY dependent on your current implementation. Change anything at all, and it might break.
It also means you need to tell us exactly what you have if you ever hope of a useful answer.

Second, why do you need to know, and what are you going to use the answer for (there's probably a better way).

Salem 5,265 Posting Sage

Post your code.
Ask a question about that code.

Don't forget to read the "how to post code" links at the top of the forum (actually, forget that, I know you're not going to do that, so it's not really worth mentioning to begin with)

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

http://uk.answers.yahoo.com/question/index?qid=20090719045724AAXrL40
Either you ignored everything said, or you're a troll spamming other peoples questions just to get your links on the board.

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

Phd huh?

Did someone also suggest your degree project as well?

Salem 5,265 Posting Sage

What are you talking about - gedit is an editor, not a debugger.

You edit the code with the editor

You then compile it with say
gcc prog.c

You then debug it with
gdb a.out

$ gcc -g prog.c
$ gdb a.out
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) help
List of classes of commands:

aliases -- Aliases of other commands
breakpoints -- Making program stop at certain points
data -- Examining data
files -- Specifying and examining files
internals -- Maintenance commands
obscure -- Obscure features
running -- Running the program
stack -- Examining the stack
status -- Status inquiries
support -- Support facilities
tracepoints -- Tracing of program execution without stopping the program
user-defined -- User-defined commands

Type "help" followed by a class name for a list of commands in that class.
Type "help all" for the list of all commands.
Type "help" followed by command name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
(gdb) help breakpoints
Making program stop at certain points.

List of commands:

awatch -- Set a watchpoint for an expression
break -- Set breakpoint …
Salem 5,265 Posting Sage

Use a debugger

Put a breakpoint at the start of isKnownWord

Single step the code to follow the path it is actually taking.
When it goes somewhere unexpected, you've found a bug.