WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

C'mon people. C++ is C++ whether TurboC Ver 1 or MSVC.NET (for the most part).

There are a few things you have to keep in mind at high level programming but at basic learning it doesn't matter what compiler you use as long as it's solid. Yes the older compilers don't follow the current standards 100% (but neither do current compilers) but what they implemented was looked at when the standards were adopted.

When compiled, the program from TCver1 works the same as DevC++.

And I can guarantee the problem exists no matter what compiler he uses, so please let's concentrate in the OP's problem rather than an upgrade that produces a non-fix.

JMAO :twisted:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

0x10 is an interrupt vector, which is a hard-coded memory address where an interrupt handler begins. This can only be used in old 16-bit MS-DOS programs.

An older C/C++ compiler can build these programs even on Windows XP machines. And for the most part they will still work. The Command Line is still DOS-based and emulated the interrupt vectors.

Here are assembly language tutorials. If you want to learn interrupts then you will need to know basic assembly language.

That's not quite true. You don't really need to know assembler as long as you know how to access the REGS structure. It's all taken care of for you.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Nice! How do they make it look like the guy is moving? Is it simply the change from negative to normal that does that, or is the second frame changed aside from the colors?

I just checked. There are 4 frames. Frame 1 and 2 move him forward just a bit. Frame 3 and 4 are duplicates with reverse color.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

here and use

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
cout << "i Am MALE"<<endl ;

:eek:

He was just hoping... :mrgreen:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I don't think Mr Disney needs to be taught anything if he says he's written all those tutorials he says he has written. ;)

Oh, I definitely nead to be taught. I am actually very weak on C++. C is my language. That's why I asked.

I figured

delete [] map;

in Destructor would take care of removing my array.

Don't figure. It will remove the pointer, but that's no guarantee it'll delete the arrays. You should use one delete for each new that was executed -- and in reverse order. Many systems will actually clean up after you, but it's bad practice to assume that cleanup will be done. So always delete every allocated buffer.

WaltP, what's the benefit of loading each pointer with structure separately?

I don't kow if there is a benefit. I haven't spent the time analyzing ~s.o.s~'s solution. On the surface, it looks good, so it depends on how you understand the the your allocation technique. Use the one you understand.

~s.o.s~, I do test my code with compiler, it's just I'm not at the stage of getting any meaningful results out of the project - but since I'm just learning it makes sense to write some extra functions to test intermediate progress.

Absolutely. Use a lot of output statements, too.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Dani, I was wondering if you had any thoughs on this request. I didn't want it to go away at least without a comment...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

~s.o.s~

The project will require me to dynamically allocate memory, not for this array, but for a link list I'll also need to have.

Here's what I've done for this array:

in the header file I created a pointer to the struct

City* map;

and in the constructor I did the following:

map = new City[200];
    for (int ii=0; ii<200; ii++)
     map[ii].visits = 0;

How is this solution? I believe this is how I'd be alocating memory dynamically, if I needed to. Just have City[array_size_variable]. Is this correct? Thank you for your help.

No. You probably want:

City* map[200];    // declare an array of pointers

...

    for (int ii=0; ii<200; ii++)
    {
        map[ii] = new City;    // load each pointer with a structure
    }

And btw, yes your code is fine for the time being.

It is? If so, I stand corrected. I've never seen it done that way.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Yeah we have to take a sucky test just to prove that we really have a desire to learn...:(

Still don't understand. If the test is to prove you want to learn, doesn't asking for the answers mean I don't want to learn, I just want to say I do?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

there is no company called M$.

Sure there is! I use their products all the time -- and complain loudly when I do!!!

If it wasn't for M$, us power users would still be able to do things instead of trying to get around security on our own machine. One size fits all! Bah!!

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

They have a very good sound. There didn't seem to be anything Indian/Pakistani about the sound other than the lyrics. Sounded like a totally western style to me.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

... if I spent a grand...

A grand? Since when does the UK use grand? :p Shouldn't that be a tonne? :twisted:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

JJ is such a boring name...

So change it to Gingledorfer ;)

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Do, to piggy back on the answer by Mr. ~s.o.s~ :mrgreen: you should probably just declare the map as City map[200]; . That would fix your problem.

I also hope this line is not in your header file. It should be in your code file only.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

we're not here to do peoples' homework for them Walt, as you should know ;)

Sorry :sad:

can't you help me out.. i mean in antivirus programming direction.. i want you to give me direction to start. i know c++ and assembly which is used for it.:sad:

Yes we can. So is it graphics? Or is it anit-virus?

Your anit-virus is in another thread.

As for graphics, ask a question we can answer. Post the code you're having trouble with. And if you are expecting us to teach you from ground up it's gonna take a looooong time -- best to check out some tutorials or better yet a book or class.

Have you read the forum the Rules?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

>>How long is a piece of string?
depends on where you cut it with your scissors. (sorry for the bad joke, I just couldn't resistet temptation :eek: )

Its twice as long as half its length, of course ;)

If you cut off both ends, the string is endless. So there! :p

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

It's probably producing income for the country... :-|
And the way they spell it's obvious that English is not even a second language with them! :twisted:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

My kid just entered kinderarten and I still have his entrance papers. Where should I send them?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

OK

#include <stdio.h>
int main()
{
    puts("computer graphics programs");
    return 0;
}
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Interesting!

Doubly so because it wouldn't run in IE, but would in Opera and FFox!

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

mood altering drugs are foolish

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Only three

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Good. I hope it works.


:confused:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Open both files 
Open a new file for the merged data
Read a record from each file into Data1 and Data2
Start a loop
    If Data1 < Data2 then
        output Data1
        read a new Data1
    else
        output Data2
        read a new Data2
    endif
    continue with loop

I will let you figure out what to do when you reach the end of a file. That is something you must consider.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

The problem is when you do scanf ( "%c", &reply ); you press two keys, a character and ENTER. The scanf() reads the character and leaves the ENTER for the next read. You need to clean out the input buffer (and fflush() is not the way to do it). You can use a loop that reads the input buffer until it reaches '\n' at which point it exits. That way you can enter YES, YEAH, YOU BETCHA and the read still works fine.

And be sure to read the links Salem posted.

SpS commented: Good ~~SpS +3
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I need to Construct a program that inputs the entries of two matrices and multiplies them. Construct the program so that it gives an error message if they cannot be multiplied.
What I have done so far

I need to Construct a program that inputs the entries of two matrices and multiplies them. Construct the program so that it gives an error message if they cannot be multiplied.
What I have done so far

Department of Redundancy Department. :mrgreen:

And your question is?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

fscanf() will read just one word at a time, which will greatly simplify the solution to the problem.

True, but you learn nothing about how to parse a string, which I would assume is the lesson to be learned here.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

How about an OPEN statement followed by READs? I guess I don't understand why an INI file is different from any other file....

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I pretty much agree with sunnypalsingh. In 30+ years I've never met anyone certified in software languages. Only in hardware and hardware related things like networking and A+, and stuff like that. Put your money into a class instead where you can get help directly from a live human instructor. Or at least mostly human. ;)

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

All enemies cry with PERISHABLE swordsmen.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

them into hysterical

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Us is a very bad word to start a sentence with.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Yes, but you have to post what you currently have for the next two functions (at least an attempt), and a detailed description of what the functions are supposed to do. If you haven't made any changes, you haven't done anything we told you about. If you have, we don't know what the code is now.

So, no detailed description. We don't know if you are supposed to test in the function, simply return the value to be tested outside the function, or what. Details....

iamthwee, what exactly are you looking for with the text files? you mean the initial file that has to be read in?

Again, he's asking for details. What is it that makes the program work? Code files, data files, header files. Basically what we need to understand the problem.

Ok on to the "get"function here's what I have. What I'm not understanding is how it works. The purpose of this function is so you can check whether a particular cell is alive or dead (true or false) right? Where is the specification as to the particular cell (i.e location)? Does this come from the client code?

Probably.

boolMatrix boolMatrix::get(booleanMatrix)const
{
      return booleanMatrix[row][col];
}

The way this is written, somewhere else row and col are set to the specific location that is to be tested. This function returns the value of that position. I assume this value is then tested after the function returns.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

hogged the hedges

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

no, that's no longer QBasic.

Sometimes you have to bite the bullet and do a minor upgrade... And some of the links I posted are for QBasic compilers.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

So can anybody help me with the next two function? Assuming the first one is solid... which I'm still unsure of.

Yes, but you have to post what you currently have for the next two functions (at least an attempt), and a detailed description of what the functions are supposed to do. If you haven't made any changes, you haven't done anything we told you about. If you have, we don't know what the code is now.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Not without code tags and an explanation of what is wrong. We aren't psychic...

When you typed in your posts, did you notice the background was not pure white? They are actually words. They can help.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I thought S.O.S. mentioned the use of code tags. There's a link at the top of the forum. There are letters and words on the back of the input box you typed your message in called a watermark that explains them -- no it's not just a dirty background. And you should have gotten a couple PM's about it....

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I prefer the second form. I personally don't like prototypes in a function body. They get lost too easily.

You also don't need so many lines between code blocks. The farther they are away from each other the harder it is to compare.

SpS commented: Same here: SunnyPalSingh +3
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Is there a better way to compare a character array with a cpp string?

There are other ways, but not necessarily better. For just two characters yours way is efficient. If you had to test 4 or more, a loop might be better.

There are also the C-string str???() functions and C++ strings compare methods. Either of those you can look into.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Okay so I have my 2D array which is of type "boolMatrix" I'll call the array "booleanMatrix". So in my default constructor I hvae the nested for loops that go down the rows and across the column. Instead of returning false, does this work:

boolMatrix::boolMatrix()
{
    for(int row = 0; row< num_rows; row++){
        for(int col= 0; col<num_cols; col++){
            booleanMatrix[row][col] = false;
        }
    }
}

MUCH better. :mrgreen: Although you want to format your code, so I took the liberty...;)

I'm not clear on where to place the error checking?

Error checking goes where you might have errors, such as reading in a value from the user or a file that's bogus.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Opinions are like ***holes -- everyone's got one.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

One of my favorites, a guy sitting in front of a computer monitor:
"Testing. Testing. 001 010 011 100..."

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Well my logic was to initialize everything to false.

Good logic. How does this function do that? The first time you enter both loops you exit the entire function, never setting a thing.

I'm not sure how to check for errors. This is why I'm here. I'm desparately needing help. Our class started with 28 people and it's down to 5. The teacher doesn't really explain this stuff very well. If you could help me, I'd really appreciate it.

if ((row < 0) || (row >= num_rows))
{
    // error condition
}

Display the values as you read them to make sure they are being read properly.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

First off, print out the number just read in addition to all the other stuff.

Second:

fin.open("numbers2.txt");
	while (fin)
	{
		for (int x=0;x<20;x++)
		{
			fin>>arnNum[x];

1) Why the while statement followed by a for statement?
2) What happens if fin>>arnNum[x]; causes an error?

Third, if you need to "display all the acutal values" you' should save them in an array for later use.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Please describe what this method does:

boolMatrix::boolMatrix()
{
     for(int row = 0; row < num_rows; row++){
         for(int col = 0; col < num_cols; col++){
              return false;
         }                          
     }
}

The function makes no sense

void boolmatrix::set (boolMatrix booleanMatrix)
{
     ifstream infile("location_alive.dat");
     int row, col;          
     
     
     while(infile){
           infile >> row >> col;
           booleanMatrix.set(row,col,"TRUE");
     }    
}

What happens if you read row & col and they are out of bounds? You should check for errors.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

>The last node(s) will always have two free child positions, won't it?
A full tree in this case is one where every non-leaf node has two non-null children.

{pictire snipped] is not because b is neither a leaf nor has two non-null children.

Oh... OK. I didn't realize that was a definition. Thanks.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

But then again