Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Declaring Objects
When one works with classes, each instance of the class which is defined is known as an object. C++ is an extremely object oriented language (perhaps not so much so as Java, however). In OOP, or Object Oriented Programming, one can easily perform multiple tasks on objects which are created. For example, when one declares an instance of the class, they can enact numerous functions upon that instance of the class.

Structures
Structures, or structs, are a simpler form of a class. They allow the creation of objects which handle multiple variables, but no functions. For such a reason, all variables within a struct can be considered public to the entire program. While structure instances are declared the same was as class instances, one can only work upon a variable in a struct (as opposed to variables and functions in a class).

struct student
{

char[10] name;
float gpa;

};

The above is a simple structure which handles students. By declaring student Jason; for example, the variable Jason is created of type student. This is similar to how an instance of a class is created. One can deal with the name and gpa of Jason by simply using Jason.name[] and Jason.gpa.

Pointers
In its simplest form, RAM (random access memory) can be throught of as a huge series of slots with addresses, each containing different data used by the computer. …

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Instances of a Class
An instance of the class is an object which is created based on the class definition. A programmer using a pre-defined (previously written by another programmer) class has the opportunity to use certain functions which have been decided by the programmer of the class.

Perhaps the only simple way to truly understand classes is to actually write many of them. By doing so, you will get a feel for which members to place in the public section and which to place in the private section.

Logic Behind Data Members
In general, variables are placed in the private section when the programmer only wants them to be seen by other functions in the class. Such variables cannot be edited directly from functions outside of the class. In fact, they can't even be viewed outside the class! For this reason, special functions must be written whose sole purpose is to print out or return the data contained in private variables and not to change anything.

Of course, given the particular circumstances, there must also be public functions to make changes to the private data. Last but not least, a constructor function (whose name is, interestingly enough, the same as the name of the class and contains no return type) is used to set the initial values for the private variables when a new instance of the class is created. Constructor functions may or may not have parameters being passed in from outside …

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Recursion
Recursive functions are, interestingly enough, functions which call themselves. Instead of performing calculations by calling other functions, they call themselves by passing in different parameters each time. This forms an almost loop-like effect, where each time a simpler calculation is performed by the function. This is repetitively done until a base-case is met.

Recursive algorithms are not simple and their execution takes up a large amount of space in memory. For this reason, iterative (start to finish, streamlined) algorithms are much more desirable than their recursive counterparts. Although recursion should generally be avoided, there are still algorithms which can only be solved with its use. For such a reason, it is important to study recursion.

The following is the simplest form of a recursive function:

int number()
{

return number();

}

Notice that the function tries to return a value, but to return that value, it must call the function over again. This will result in an increasing stack in memory. Unlike an infinite loop, however, this function will not execute forever. Rather, it will execute until too many calls have been made not getting anywhere. At such a time, it will automatically exit by itself.

Recursive Counters

int count(int x);

int main()
{
int x = 5;
cout << count(x);
return 0;
}

int count(int x)
{
if (x == 0) …

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

True and False
The backbone of computer science is logic. Most often, those with logical minds make the best programmers. Hence, a very important programming concept is that of boolean algebra.

A boolean expression is a true or false statement. In the world of computers, a true statement is represented by 1 while a false statement is represented by 0. Low level computer programming (the logic inside a computer) is actually a series of zeros and ones.

The following chart diagrams the most common symbols of equality used in boolean algebra. Note that assignment statements use a single equals such as = while boolean algebra uses the double equals ==.

Symbol Usage
== equality
< less than
> greater than
>= greater than or equal
<= less than or equal
! not
&& and
|| or

For example, the statement cout << (3 == 4); will print a 0 to the screen since it is false that 3 is equal to 4. However, the statement cout << !(3 == 4); will print a 1 since it is true that it is NOT true that 3 is equal to 4. Boolean algebra can become a bit confusing, but with some practice is is extremely logical. It may be wise to investigate truth tables and discrete mathematics when first introduced to boolean algebra.

Branching
Boolean algebra is used to create branch situations in programs. For example, if …

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Organize Your Data
Arrays allow programmers to store a series of data of the same type. For example, suppose a program is to keep track of twenty numbers. Such a set of numbers would be stored in an array of integers (whole numbers) or doubles or floats (decimals). Arrays work very similarly to variables in that they must be declared and are given a type. The only difference is that each time an array is referred to, brackets indicating the index that you are referring to must be used. Unless passing in and out of a function (as in a function header), arrays cannot be referred to as a whole. Rather, the index one is referring to must be specified. Array indices for an array of size n begin at 0 and increment by 1 to n-1.

Graphical Depiction Of Arrays


my_array[5]

0 12
1 28
2 83
3 18
4 2


The above is a graphical depiction of an array of integers named my_array of size five. It would be declared by stating int my_array[5]; Doing so would tell the computer to leave room in RAM for five integers. From then on, each can be referred to as if it were an individual variable. For example, to access the number 83 one would make reference to the variable my_array[2]. Array indices can be worked with exactly as other variables. In addition, the index of an array may be a variable itself. …

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Flowcharting
Pseudocode can almost be classified as half-code, half-text. Even as its name implies, it is semi-code. It is used by a programmer to outline the algorithms he or she has written, before they are actually translated into code. It is almost a high-level abstraction of code. For the most part, an algorithm to perform the same task in multiple programming languages is the same. The following is an example of pseudocode to ask the computer to input two numbers, and then print out their sum:

input A
input B
C = A + B
print C

Using Functions
Pseudocode can also be used to interact between functions. By writing our your algorithm in such a way, not only can you easily convert it to any language you choose. It is also much easier to debug (fix) logic errors. Logic errors are those where the entire process being used from point A to point B is not rational or it doesn't work. Using pseudocode to pass variables in and out of functions can enormously help you, especially by using it as a reference guide when writing the code, itself.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Functions
Locality encompasses the idea that it often takes many, many programmers to come up with a single software program. Virtually all programming languages are constructed in such a way that these various programmers don't even need to interact with eachother. This is possible because of locality.

Programs are broken down into what are known as functions. Each function may be written by a different person. By separating local and global variables, functions can theoretically stand on their own. Local variables are those variables which are created inside a function and used inside that function, alone. Global variables are those which can be seen throughout multiple functions.

Passing Parameters
Parameters are variables which are passed into functions from other functions. Once they are passed in, the function can use them in the same way as they use other local variables. This ability adds to the use of locality. For example, suppose someone in California were to write a program to calculate loan interest when the amount for the loan and the interest rate are passed in as parameters. Someone in New York can make use of this function by passing in the two parameters needed. Someone in New Jersey can make use of this function, as well, by passing in his or her own two parameters. Not only do the three programmers never need to meet. In addition, the programmers from N.Y. and N.J. don't need to know exactly how the function was written.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Software
Computers contain hard drives, storage mediums for one's own documents as well as software programs. Software for computers are manufactured by numerous companies and individuals and made to work with a given operating system. Currently, Microsoft has a nearly complete monopoly on operating systems, bringing us all versions of Windows (3.1, 95, NT 4, 98, 98se, 2000, Me, XP). Other operating systems include Apple's OS X (which will only run on Macs) and Unix (and its derivatives). Unix comes in multiple flavors (such as Linux and the BSDs) and will run on a wide variety of platforms.

Not only are operating systems, themselves, written with a programming language, but software made for them is written with the same languages. All software which was written for a computer was developed using a programming language, a sequence of words and symbols which tell a computer exactly how to behave under certain circumstances. When software engineers write programs, they use what is called a high-level language.

High-Level Languages
High level languages include BASIC, Java, and C++. Quite fortunately, a computer is able to differentiate between the various high-level languages and act accordingly. When a computer reads a high-level language, it processes it into its own internal low-level language, a specific sequence of binary digits (0s and 1s). The computer then interprets these binary digits to handle virtually any situation which is posed.

For example, a language tells the computer what is to happen when a …

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Creating Executables
Of course, the software on your computer isn't all a bunch of code in a high level language, at least not in the form you receive it in. Before you can run any programs which are written in C++ or Java, they must be compiled. Compiling is the process by which a computer reads the code which you have written and interprets it. Usually, this is followed by the creation of an executable file. Executables are files which can be run by a user, like programs.

Compiling Your Code
To compile a program, you need to make use of a compiler. Each programming language available requires its own compiler to process the code. For example, one needs one of the many C++ compilers to process C++ code, similarly to how one needs a Java compiler to process Java code.

There are numerous compilers available, each one specific to a particular operating system and language. While free ones are available, they often prohibit the use of legally selling the software you create with them. It goes without saying that each compiler may have its own little quirks. For example, while trying to compile one of your programs, you may receive a simple warning when using one compiler. While using a different compiler, however, you may generate a programaming error, prohibiting your code from being compiled at all.

One of the most well known compilers for Windows machines is Microsoft Visual Studio 6.0, consisting of …

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

There is little doubt that one of the most daunting tasks in all of computer programming is that of developing your own algorithms. Indeed, it is here where the term Computer Science comes to the fore as it is virtually a step-by-step process, so intricate and precise it truly is a science to master.

So what exactly are algorithms? Simply put, these are step-by-step methods which a programmer tells a computer to follow. They often branch out under certain conditions, in the same way that as humans with brains we follow trillions of algorithms in our daily lives although you don't necessarily think about them. For example, you are following an algorithm in order to add two numbers, to walk down a flight of stairs and even just to move our heads.

Let’s take walking down a flight of stairs as a good example to examine more closely. You begin by placing one foot in front of you and then following with the other. Then you notice that there is another step in front of you, so we do the same again. You keep repeating this process until you finally see there are no steps left, and then note that you have reached the bottom of the stairway. This is the most basic form of an algorithmic process, but the next step you must take is to understand variables. All programming languages involve the use of variables, keywords which are used to represent numbers, letters, and symbols in …

mattyd commented: Algos \ well-written and concise +2
majestic0110 commented: nice :) +3
ourchiliean commented: You have helped me to understand a little more, tank you +0
morten42 commented: Excellent post +0
pritaeas commented: Well written +4
The ICE Man commented: Very Good, and well written :) +0
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Alternatively, you can use Apache's mod_rewrite. I have used this so all forums and threads can be written as forum5.html and thread123.html, for example. Of course, I haven't taken the time to do this for all my pages. Perhaps I will when the new VB3 style is released :)

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Does it beep at all? Is the monitor snugly connected to the back of the video card? You sure everything inside the machine is snug?

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

windoze --> microsoft

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

It seems to me as if gicio might indeed be using it for large strings, and is just providing these small "test" strings as an example to learn how to use it.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I feel like I'm in an algebra class! So who CAN'T ping who?

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I'm not so sure we should post spoilers in this thread ... yet ;)

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Hey there! Yes, we have a bunch of new moderators now who have all volunteered their time to help make TechTalk a better place ... and I'm definitely grateful to ya'll!

peterska and rixius, thanks both for your welcome :)

Check out the Usergroup page for a listing of all our new moderators!

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Is there a reason you're talking in Spanish?

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

The IMAX version is different though ... I would assume it'll be nice with all those special effects and action scenes. For once I'd like to see a real movie like that in Sony 3D Imax!! Now THAT would be GREAT!

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Great post! :) Thanks Big B.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

understanding --> thinking

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

deafening silence --> hearing

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

bug-free Windows --> oxymoron

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Ahh! :( You sure do know how to break a gal down, eh? ;) (just kidding)

Okay okay where shall I start. First, this program was written my third semester at Hofstra for a data structures and algorithms course. (It was a theoretical course; the C++ was simply an exercise). It was a homework assignment meant to demonstrate my knowledge of the QuickSort. It was basically a "sort coordinates via a quicksort, exercise for a weekend" given Friday due Monday type deal. Now that I actually think back to it, I think we had a week for it.

As for over-commenting, I know I did ;) Basically I was taught right off the bat that over-commenting is great and deserves extra commendation for effort. In retrospect, my freshman professors might have told me so simply because it's easier for them to grade algorithms instead of teaching the best coding style. Of course, commenting is also a great way to learn computer programming. My current commenting style includes a detailed (probably too detailed) pre and a post above all functions/methods and very little else. (I'll use a pre and post even for one line functions that are plainly obvious, if for nothing else than consistancy for all functions). Alternatively, I'll comment function prototypes in my header files.

As for using better variable/function names ... I definitely see the point of this. I try to do it as much as I can (now) but I'm often guilty, unfortunately. I …

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

MSN Explorer is basically Internet Explorer with a fancy skin. The skin adds a bunch of extra features to IE such as buttons to go instantly to hotmail and other MSN member/premiere sites. Changing your IE preferences changes your MSN Explorer ones as well, being as MSN explorer is really just IE ;)

Running Windows/MSN/.NET messenger while running MSN Explorer doesn't necessarily conflict. It will just sign you out of one while automatically signing you into the other. You can still run both programs simultaneously (no real file errors) - you just can't be signed into both at the same time.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Sorry, the only way to run the test program is off of a floppy disk which boots on startup. You cannot skip that section because that skips creating the program you want to run! See if you could borrow an external USB floppy drive from someone.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

First, you can't do that unless you have compression software installed. If you're in Windows XP, it's built-into the operating system. If you're using a different operating system, you'll need to install compression software. You can use WinZip (http://www.winzip.com) or Aladdin StuffIt Expander (http://www.aladdinsys.com).

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Go to this page: http://www.hgst.com/hdd/support/download.htm

There, you can download the Drive Fitness Test. According to the website, it "performs real-time analysis of your drive to quickly determine whether the drive has a problem."

Seems just what you need!

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

relief --> stress-free

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Thank you ... I have a very definitive coding style.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

condom --> sex

(Please people, let's not get more descriptive, so to speak, in this public forum.)

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Linus --> blanket

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

headache --> sinus

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

under-qualified users --> n00bies ;)

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Where did you get the # 80,000 from? I doubt the harddrive is so worn out as that ... the rest of the laptop's specs seem to be relatively new technology. We're not talking about a 7 year old machine here.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Right click on any link and choose Open in New Window (or something similar). This works in just about all web browsers.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I would never had the courage to remove a laptop's hard drive - unless, of course, it was modular. Did you by any chance note the name of the hdd manufacturer?

Often times, manufacturers supply low-level drive checking programs which will test a drive for physical errors / bad drives. For example, Western Digital has one such utility you can download from their website - but of course it only works with WD drives.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

WAN --> Internet

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

The attached program performs a QuickSort in C++ which sorts an array of structs based on their data members. Basically, it sorts an array of coordinates based on their distance from the origin.

cosi commented: Dani, meticulous coding. I like your style! :) +1
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

The forum layout was just redesigned. I decided to separate the Web Development section into a category of its own, separate from the Application Programming languages. There are no new forums and no threads moved. This only affects the hierarchy of forums and subforums as far as layout is concerned. Hopefully this better expresses what TechTalk is all about!

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Please don't post a quote without any unique text of your own.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Gee I've never heard of that error before. It might be simply connection problems. Are you behind a firewall/proxy? If so, set the configuration in the preferences.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

What is the exact error message? A popup window just saying NO? Windows comes with Windows Messenger while MSN comes with MSN Messenger. They're essentially the same thing except that MSN Messenger integrates a bit better with MSN Explorer.

To permanently disable Windows Messenger from your computer, and solely use MSN Messenger, you can use one of those programs in the Administration Tools in the control panel. Unfortunately I don't remember which one it is right now or where ... and I'm sorta busy :( Do a search for it, I'm sure it will turn up.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Please tone it down a notch, people. Thanks. Remember, this is a public forum for all ages.

This was asked somewhere else, so let me clarify: Any age to view threads, 13 or over to register/post.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I had a GigaByte board with my AMD machine. No complaints about it but I wasn't exactly thrilled with it either. It was just "okay". Then I got a P4 with an Asus motherboard and I've never been happier. Since then I will only buy from Asus. :)

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Hi! Thanks everyone :-D !!!

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Well after 5 reformat / reinstalls, 3 pots of coffee, 2 sleepless nights, and a couple of Smiths & Morrissey albums later I have figured it out... AMD is super picky about (new) hardware. Especially during the installation of an OS (WIN XP), those of you with similiar hardware specs as myself (listed above) pay heed!!! You *MUST* only install your graphics card during OS installation... afterwards your free to install anything else you could possibly wish to slap in your system.

I had an NVidia Geforce 3 card in my Athlon XP. I upgraded to a Geforce 4 Ti and started having these problems. I thought it was the video card! A reformat didn't even work :( When I later got a P4, solution solved.

Years ago I had the same problem with an ATI Rage 128. I forget how I solved it.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

Why don't you install SP1? If anything it'll fix a lot of bug and security patches.

Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

It should be like this:

If all you want to do is change the .shtml extension to .html

RewriteEngine on
RewriteRule ^(.*).shtml$	  $1.html [L]
Dani 4,653 The Queen of DaniWeb Administrator Featured Poster Premium Member

I'm a little confused. I haven't looked at VB in a a bunch of years, but that code you just posted looks right? The only help I can offer is to DIM your global variables in Option Explicit. It seems you have them all declared upon hitting the "Save" button. This resets the value of curOrderTotal back to 0 each time the Save button is pressed. (So essentially you'er saying curOrderTotal = 0 + curTotal each time, which is why it's not accumulating.

I THINK, ANYWAYS! I haven't looked at VB since 10th grade and I'm now a college senior!