Programming
All tutorials in Programming
Sort By:    Name   Rating   Views  Comments    Date 
Browse Pages :    <<  <  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  >  >> 

Often, especially at the start of semesters, I get a lot of questions about how to write very simple programs. Typically, the problem to be solved is to read in a few numbers, do something with them, and write out an answer.

Views: 233 Comments: 0
A Coding Convention for C++ Code
Submitted 05 May 2008

Classes are declared in the following order: public member functions, protected member functions, private member functions, protected data members, and private data members. No data members may be declared public.

Views: 240 Comments: 0
C++ Coding Standards
Submitted 05 May 2008

Take warnings to heart: Use your compiler's highest warning level. Require clean (warning-free) builds. Understand all warnings. Eliminate warnings by changing your code, not by reducing the warning level.

Views: 247 Comments: 0
A Manual of C Style
Submitted 05 May 2008

The first edition of this book both introduced the C language to the world and set a standard for clear language tutorials with a consistant style of presentation. The second edition accounted for changes in C introduced by the ANSI C standard. However, as with any short work, these books provide little advice about structuring large programs or other software engineering issues, and the C style...

Views: 388 Comments: 0
Function Basics in C++
Submitted 04 May 2008

Now that you know what a function is, let's look at function syntax. We've already seen that a function can take some inputs, do some stuff, and then produce an output.

Views: 267 Comments: 0
What is a Function in C++ ?
Submitted 04 May 2008

Up until this point, every line of code we've shown you has done a simple task, such as performing an arithmetic operation, or checking a boolean condition, or assigning to a variable. Functions allow you to do a whole lot in one line of code. Instead of performing a simple task, a single line of code can display a menu of choices, or compute complicated three-dimensional transformations, or even...

Views: 870 Comments: 0
Loops (for, while, do) in C++
Submitted 04 May 2008

So, upon initial execution of the loop, the integer variable i is set to 1. The statement total = total + i; is executed and the value of the variable total becomes 1. The step code is now executed and i is incremented by 1, so it's new value is 2. The test_condition is then checked, and since i is less than 11, the loop code is executed and the variable total gets the value 3 (since total was 1,...

Views: 281 Comments: 0

The next branching statement is called a switch statement. A switch statement is used in place of many if statements.Let's consider the following case: Joel is writing a program that figures interest on money that is held in a bank. The amount of interest that money earns in this bank depends on which type of account the money is in. There are 6 different types of accounts and they earn interest...

Views: 290 Comments: 0

When a programmer is crafting a program, it is good practice to break the program down into pieces that can be thought of independently. Once the program has been completed, we can think of its execution as being a series of these pieces that work together in a certain sequence. These pieces then pass the control of the program between each other. While one piece has the control, the other pieces...

Views: 397 Comments: 0
Operator Precedence in C++
Submitted 04 May 2008

What will be the value of result? The answer depends on the precedence of the operators. In C++, the multiplication operator (*) has higher precedence than the addition operator (+). What that means is, the multiplication 5 * 6 will take place before either of the additions, so your expression will resolve to 4 + 30 + 2 , so result will store the value 36.

Views: 241 Comments: 0
Casting of Variables in C++
Submitted 04 May 2008

In any programming language, and especially in C++, it's important to have at least a cursory understanding of what the computer is doing "behind the scenes". Since we're talking about variables in this chapter, it's important to understand how a computer stores the information in variables.

Views: 234 Comments: 0

A variable type is a description of the kind of information a variable will store. Programming languages vary regarding how strict they require you to be when declaring a variable's type. Some languages, like Perl, do not require you to announce the type of a variable. Other languages require you to declare some variables as numbers and others as text-strings, for example. C++, a strongly-typed...

Views: 457 Comments: 0
What is a Variable in C++ ?
Submitted 04 May 2008

A variable is a place to store a piece of information. Just as you might store a friend's phone number in your own memory, you can store this information in a computer's memory. Variables are your way of accessing your computer's memory.

Views: 367 Comments: 0
Operators in C++
Submitted 04 May 2008

Before talking about operators, we'll take a quick aside into booleans, since we'll need to know what a boolean is before discussing operators. A boolean value is one that can be either true or false. No other values are allowed. Booleans and boolean operations are at the heart of programming. Many times in a program, you'll want to do one thing if a certain condition is true, and a different...

Views: 232 Comments: 0
Compiling and Running in C ++
Submitted 04 May 2008

Depending on your computer and your compiler, the process of compiling your program varies. For now, we'll assume that you are using a UNIX machine and the gcc compiler. Gcc is a free compiler which is available on virtually all UNIX systems.

Views: 239 Comments: 0
Browse Pages :    <<  <  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  >  >>