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
disinfecting cleaning services Arlington Heights ..There are two approaches for application integration:? Programmer's approach ?... Read More
With so many Microsoft Windows related viruses, errors, and other... Read More
What is 'adware'?Adware is basically software or scripts that are... Read More
In the real world a "fire wall" is a fireproof... Read More
Microsoft Business Solutions Great Plains has I'd say end user... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics/eEnterprise... Read More
Task Manager is a Windows system utility that displays thetasks... Read More
There are several kinds of software piracy. The bottom line... Read More
The Windows Indexing Service provides you with the ability to... Read More
Are you a whiz at calculating financial information? Not the... Read More
What is IRC?IRC is Internet Relay Chat. It is a... Read More
Microsoft Business Solutions CRM is now approaching the phase of... Read More
This article illustrates the best practices to improve the performance... Read More
Several software companies design programs for preventive maintenance. Most of... Read More
I started using PIP (Picture It Publishing) Platinum 2002 right... Read More
Security flaws have long plagued Internet Explorer (IE), the market-dominating... Read More
At the end of XX century, in the late 1990th... Read More
We'll give you non formal view, based on our consulting... Read More
Microsoft Business Solutions Great Plains and MS CRM (client relation... Read More
Homeland security, airport security, Internet security ??" these days we???re... Read More
Lotus Notes Domino is very efficient in electronic document workflow... Read More
And kill the best layout software in the process of... Read More
Is Photoshop CS2 worth the upgrade? You bet it is!... Read More
Features Additionally, Vista will include many other new features.Aero Vista... Read More
Let us give you - developer some hints in the... Read More
bathroom cleaning service Mundelein ..OEComplete is a utility for managing the personal information of... Read More
Since its release in 1987, QuarkXpress had made an immediate... Read More
Microsoft Word is one of the most popular office applications... Read More
In today's business world it's all but impossible to escape... Read More
The destruction of the Soviet Union about 15 years ago,... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Handling character strings in Java is supported through two final... Read More
Are you a database professional? Do you work with a... Read More
What is 'adware'?Adware is basically software or scripts that are... Read More
TCO (Total Cost Ownership) is the buzzword in... Read More
GroupwareThe internet is full of 1.5 million to 7 million... Read More
Some introduction into Great Plains Software products, now Microsoft Business... Read More
Microsoft Great Plains fits to majority of horizontals and retail... Read More
It's all about turn times in the eMedia industry! The... Read More
Spyware is software or hardware installed on a computer without... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
In linux, one of great commands for finding out information... Read More
Not all of us have the luxury of working both... Read More
Now there are Three Steps To Heaven Just listen and... Read More
Around the same time Microsoft made its move with .Net... Read More
Microsoft CRM was designed to be easily customizable. Microsoft CRM... Read More
Microsoft Business Solutions Great Plains is very good fit for... Read More
CD and DVD replication is a process that works by... Read More
The COSMIC FP (function point) software quality metric, is no... Read More
Just the thought of a duel-boot scares many people away,... Read More
Software |