Wrox Programmer Forums
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 28th, 2010, 12:50 PM
EliteHussar
Guest
 
Posts: n/a
Default C basic tutorial

Programming tutorial
C Tutorial 1 – The basics of C
This tutorial is a port of the C++ tutorial but is designed to be a stand-alone introduction to C, even if you’ve never programmed before. Unless you have a particular reason to learn C instead of C++, I recommend starting the C++ tutorial instead. Nevertheless, if you do not desire some of C++’s advanced features or simply wish to start with a slightly less complicated language, then this tutorial is for you!
C Tutorial 1 – The basics of C
Reply With Quote
  #2 (permalink)  
Old May 28th, 2010, 12:52 PM
EliteHussar
Guest
 
Posts: n/a
Default

Programming tutorial
C Tutorial 2 -If statements
The ability to control the flow of your program, letting it make decisions on what code to execute, is valuable to the programmer. The if statement allows you to control if a program enters a section of code or not based on whether a given condition is true or false. One of the important functions of the if statement is that it allows the program to select an action based upon the user’s input. For example, by using an if statement to check a user-entered password, your program can decide whether a user is allowed access to the program.
C Tutorial 2 -If statements
Reply With Quote
  #3 (permalink)  
Old May 28th, 2010, 12:54 PM
EliteHussar
Guest
 
Posts: n/a
Default

Programming tutorial
C Tutorial 3 – Loops
Loops are used to repeat a block of code. Being able to have your program repeatedly execute a block of code is one of the most basic but useful tasks in programming — many programs or websites that produce extremely complex output (such as a message board) are really only executing a single task many times. (They may be executing a small number of tasks, but in principle, to produce a list of messages only requires repeating the operation of reading in some data and displaying it.) Now, think about what this means: a loop lets you write a very simple statement to produce a significantly greater result simply by repetition.
C Tutorial 3 – Loops
Reply With Quote
  #4 (permalink)  
Old May 29th, 2010, 05:01 PM
EliteHussar
Guest
 
Posts: n/a
Default

Programming Tutorial

Now that you should have learned about variables, loops, and conditional statements it is time to learn about functions. You should have an idea of their uses as we have already used them and defined one in the guise of main. Getchar is another example of a function. In general, functions are blocks of code that perform a number of pre-defined commands to accomplish something productive. You can either use the built-in library functions or you can create your own functions.
C Tutorial 4 – Functions
Reply With Quote
  #5 (permalink)  
Old May 30th, 2010, 07:18 PM
EliteHussar
Guest
 
Posts: n/a
Default

Programming Tutorial

C tutorial 5 – Switch case
Switch case statements are a substitute for long if statements that compare a variable to several “integral” values (“integral” values are simply values that can be expressed as an integer, such as the value of a char). The basic format for using switch case is outlined below. The value of the variable given into switch is compared to the value following each of the cases, and when one value matches the value of the variable, the computer continues executing the program from that point.

C tutorial 5 – Switch case
Reply With Quote
  #6 (permalink)  
Old May 30th, 2010, 07:19 PM
EliteHussar
Guest
 
Posts: n/a
Default

Programming Tutorial
C Tutorial 6 – An introduction to pointers
Pointers are an extremely powerful programming tool. They can make some things much easier, help improve your program’s efficiency, and even allow you to handle unlimited amounts of data. For example, using pointers is one way to have a function modify a variable passed to it. It is also possible to use pointers to dynamically allocate memory, which means that you can write programs that can handle nearly unlimited amounts of data on the fly–you don’t need to know, when you write the program, how much memory you need. Wow, that’s kind of cool. Actually, it’s very cool, as we’ll see in some of the next tutorials. For now, let’s just get a basic handle on what pointers are and how you use them.
C Tutorial 6 – An introduction to pointers
Reply With Quote
  #7 (permalink)  
Old May 30th, 2010, 07:19 PM
EliteHussar
Guest
 
Posts: n/a
Default

Programming Tutorial
C tutorial 7 – Structures
When programming, it is often convenient to have a single name with which to refer to a group of a related values. Structures provide a way of storing many different values in variables of potentially different types under the same name. This makes it a more modular program, which is easier to modify because its design makes things more compact. Structs are generally useful whenever a lot of data needs to be grouped together–for instance, they can be used to hold records from a database or to store information about contacts in an address book. In the contacts example, a struct could be used that would hold all of the information about a single contact–name, address, phone number, and so forth.

C tutorial 7 – Structures
Reply With Quote
  #8 (permalink)  
Old June 2nd, 2010, 05:57 PM
EliteHussar
Guest
 
Posts: n/a
Default

Programming Tutorial
C Tutorial 8 – Arrays
Arrays are useful critters that often show up when it would be convenient to have one name for a group of variables of the same type that can be accessed by a numerical index. For example, a tic-tac-toe board can be held in an array and each element of the tic-tac-toe board can easily be accessed by its position (the upper left might be position 0 and the lower right position 8). At heart, arrays are essentially a way to store many values under the same name. You can make an array out of any data-type including structures and classes.

C Tutorial 8 – Arrays
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial surendran ASP.NET 2.0 Basics 0 May 24th, 2006 12:15 PM
Tutorial sithius Access 1 March 13th, 2006 03:44 PM
Tutorial surendran ASP.NET 1.0 and 1.1 Basics 11 March 29th, 2005 01:30 AM
tutorial ajaikumar_2 BOOK: Beginning Visual C++ 6 1 January 22nd, 2005 07:32 AM
Need basic JSP -> Database tutorial TadReeves JSP Basics 7 January 17th, 2005 03:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.