This is the tutorial where we really get into programming. Input and variables are the essence of programming. In this tutorial you will learn how to get data from the user and use variables. You will learn the types of variables there are and how to do basic math with them. At first, this may seem boring and pointless, but you have to learn it, and it should go quick.
Basic Input
When you are making a console application, here is how you should get user input. Some of you may have guessed it, you use c[b]in[/b], of course, the 'c' meaning console and the 'in' meaning input, like 'cout'. So, here is a basic code, where the name of the variable x. cin>>x;
Defining Variables
A variable is what you guessed, a number or piece of data that will vary.
The diffrent types of variables:
bool - true or false
int - whole numbers
char - character (a, b, c, etc...)
string - multiple characters (words, etc..)
float,double - numbers that can have decimals
When deciding what type of variable to use, think about what kind of data it is going to be storing and remember that some data types use more memory than others, however most of your applications will use less memory than you have. To declare a variable, write the type of variable, then the name.
Examples:
int myInt = 7;
char thisChar= 'a', otherChar = 'b', char newChar;
string password= "password";
Syntaxes
Notice how I always had the first word not capatalized, but I capatalized all the other ones. You can also define more than one at a time, and you dont always need to set the value in the begining. Also, when you use a char, use a ' and for a string a ". Try to give your variables meaningful names.
Math
This is really the heart of programming, math! For now, we are going to be doing some simple arithmetic.
The basic math functions are:
+ = addition
- = subtraction
/ = division
* = multiplication
There are a bunch more, but that is all we need for now.
Go out and make a program!
Now that you know some of that basic stuff, try making a program, and dont be afraid to ask for help on http://www.syschat.com!
Chris Silop - http://www.syschat.com!, Computer Forum
move in cleaning service Glencoe ..Adobe Photoshop is one of the world's leading graphics editing... Read More
Designing without tables by using CSS layouts is fast becoming... Read More
Have you noticed WordPerfect is gearing up for a comeback... Read More
Some introduction into Great Plains Software products, now Microsoft Business... Read More
A UNIX Shell is in simplest terms, a command line... Read More
Microsoft CRM has built-in conversion tool, however you should probably... Read More
There are plenty of articles out there about how to... Read More
Although we don't know whether Microsoft ever envisioned such a... Read More
Microsoft Business Solutions CRM and IBM Lotus Notes Domino, being... Read More
Stop the Runaway MouseWhat's the "runaway mouse?" You've seen it...you... Read More
It would be easy to think, like most people apparently... Read More
Task Manager is a Windows system utility that displays thetasks... Read More
Do you want to get quality software at a reasonable... Read More
There are many commands that are used in linux on... Read More
What is IRC?IRC is Internet Relay Chat. It is a... Read More
Microsoft Business Solutions CRM data conversion deserves FAQ type of... Read More
With many manufacturing shops heading over seas in favor of... Read More
Should one use Windows Update?This topic has good and valid... Read More
When making a decision to buy any piece of software... Read More
How many steps does it take you to locate and... Read More
Collaboration SoftwareCollaboration Software, also known as group collaboration software or... Read More
Microsoft Business Solutions Great Plains has many years of successful... Read More
It's no secret that software companies operate in a very... Read More
Three highly respected names in Human Resources have joined forces... Read More
The Software 2005 conference is now a wrap. This conference,... Read More
disinfecting cleaning services Winnetka ..When it comes to running an office, the SOHO entrepreneur... Read More
Software Engineering is the Systematic Approach for analysis design implementation... Read More
Remember nice and prosperous Clinton era? When you implemented innovative... Read More
What is Colossus?Colossus is software licensed to about twenty-five insurance... Read More
The title of "software engineer" has got to be among... Read More
Heard about the Quark "killer"?Adobe InDesign CS2. Will it really... Read More
Whether you need to close a sale, gather end-user feedback,... Read More
Bill of Lading is required report for Logistics and Freight... Read More
The first thing that you will notice about Linux Red... Read More
Think of this, first we had the HAM Radio, then... Read More
Using professional icons in your application or website can bring... Read More
Now is the time to look at an alternative to... Read More
If you use Microsoft Outlook (or similar applications) for e-mailing,... Read More
Today's business world is fast-paced. No matter what it is... Read More
In our small article we'll consider Microsoft Business Solutions Great... Read More
1. Replace Dexterity cursor with SQL Stored Procedure Dexterity... Read More
Since its release in 1987, QuarkXpress had made an immediate... Read More
Trying to figure out a stream in banning one email... Read More
As you probably know, when Microsoft purchased Great Plains Software... Read More
SOFTWARE PIRACY We regularly hear reports... Read More
Microsoft Great Plains might be considered as ERP platform to... Read More
How do you run a program on a remote server... Read More
C/SIDE (Client/Server Integrated Development Environment) - The core of... Read More
Every organization which creates collaborative documents, whether they are budgets,... Read More
Writing software manuals is boring, isn't it? We often think:... Read More
Software |