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
detailed home cleaning Lake Forest ..What is Snort?Snort is an open source network intrusion detection... Read More
The Microsoft system preparation utility for Windows 2000 is a... Read More
Spyware is software or hardware installed on a computer without... Read More
At the end of XX century, in the late 1990th... Read More
Microsoft Great Plains is main mid-market application from Microsoft Business... Read More
Manufacturing in the USA is far away down from mid... Read More
If there still are few unprotected computers left, I haven't... Read More
Task Manager is a Windows system utility that displays thetasks... Read More
The java programming language is becoming more and more popular... Read More
No matter how much you enjoy your favorite screensavers, sometimes... Read More
I have always regretted how Microsoft price gouges and rips... Read More
Microsoft Business Solutions Great Plains is Dexterity-written application and currently... Read More
The software giants don't do everything and don't always produce... Read More
Handling character strings in Java is supported through two final... Read More
SOFTWARE PIRACY We regularly hear reports... Read More
Simply put, fleet maintenance allows companies to monitor and maintain... Read More
In this short FAQ style article we would like to... Read More
The intuitive algorithm.Roger Penrose considered it impossible. Thinking could never... Read More
With thousands of web pages added to the Net every... Read More
Finding the best spyware removers to detect and remove spyware... Read More
Program Flow is what you think it is. How the... Read More
Microsoft Great Plains serves majority of US based horizontal and... Read More
Microsoft Business Solutions Great Plains has several options to enable... Read More
If you have Great Plains Dynamics/eEnterprise (version 6.0 or earlier)... Read More
Microsoft Great Plains has full-featured Manufacturing suite of modules: Capacity... Read More
trusted cleaning company Des Plaines ..Your computer cost you from hundreds to thousands of dollars,... Read More
Google Inc. has launched a new software package that allows... Read More
The Software 2005 conference is now a wrap. This conference,... Read More
Microsoft Business Solutions Great Plains has several options to enable... Read More
Stealing company information used to be the specialty of spies... Read More
Microsoft Great Plains ? ERM from Microsoft Business Solutions and... Read More
What is Interactive Mapping?Interactive mapping is a visual display medium... Read More
Our opinion is based on our Microsoft Business Solutions Great... Read More
The software giants don't do everything and don't always produce... Read More
ERP is the acronym of Enterprise Resource Planning. Multi-module ERP... Read More
Using professional icons in your application or website can bring... Read More
Just the thought of a duel-boot scares many people away,... Read More
Microsoft Great Plains serves majority of US based horizontal and... Read More
What is Colossus?Colossus is software licensed to about twenty-five insurance... Read More
2005 ? Back to the Future.What does the future hold?... Read More
Make-or-Break Factors in Success and ProfitabilityFor quick printers, estimating can... Read More
For those who still don't know, Microsoft Publisher helps computer... Read More
We would like first emphasize the change in the paradigm.... Read More
Microsoft Business Solutions Great Plains has substantial market share among... Read More
Best Software Act! is very popular CRM for small and... Read More
Microsoft Great Plains, Navision, Solomon and Axapta are Microsoft Business... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Microsoft SQL Server is the leader for inexpensive and middle... Read More
In the Clinton era the status quo was simple: you... Read More
You've finally created databases that you can actually use to... Read More
Software |