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
best cleaning company Lincolnshire ..Homeland security, airport security, Internet security ??" these days we???re... Read More
1. What determines the software price? Is it Per Seat... Read More
Following tips help you to learn a software in lesser... Read More
It could just be me, but my experiences with document... Read More
This article is for advanced Microsoft CRM SDK C# developers.... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
I provide, here clear explanations and a count of function... Read More
The first thing that you will notice about Linux Red... Read More
IBM Lotus Domino or Microsoft Exchange?The severe competition continues for... Read More
MSN messenger is a pretty cool invention. I mean I'm... Read More
IBM Lotus Notes Domino and Microsoft CRM (Client Relation Management)... Read More
In this small article we will be looking at the... Read More
Spyware is software or hardware installed on a computer without... Read More
We all take the computer for granted. I mean, all... Read More
As you probably know, when Microsoft purchased Great Plains Software... Read More
Microsoft Business Solutions Great Plains has full-featured manufacturing set of... Read More
Microsoft Business Solutions Great Plains, Navision, Axapta, Solomon and CRM... Read More
Stealing company information used to be the specialty of spies... Read More
Microsoft Great Plains has full-featured Manufacturing suite of modules: Capacity... Read More
Microsoft Great Plains, designed back in 1990th as database transferable... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Are you one of those people that keeps track of... Read More
I like my software simple. If it's too complex or... Read More
Microsoft Business Solutions Great Plains is very good fit for... Read More
We would like to give you pluses and minuses of... Read More
on demand house cleaning Lake Forest ..In our opinion, traditional approach when you select ERP/MRP system... Read More
Several years ago Microsoft purchased Great Plains Software, then Navision... Read More
Almost all new and major brand of PCs come with... Read More
Find out why Spyware Removal from computers is important and... Read More
Stealing company information used to be the specialty of spies... Read More
Having from five to ten and more favorite screensavers is... Read More
Microsoft Business Solutions Great Plains is very popular ERP platform... Read More
Which Type of Shop Can Rely On A Home Built... Read More
Microsoft Business Solutions Great Plains has several options to enable... Read More
DBxtra goes ASPGetting to the information hidden within corporate databases... Read More
Let's say that you have a software project that's under... Read More
Microsoft Great Plains might be considered as ERP platform to... Read More
I have recently created my first Php program. I wanted... Read More
We are in a transition phase in the Managerial Administration... Read More
Whether you are a small consultancy firm, a medium sized... Read More
If you would like to pick something from Microsoft, or... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Linux essentials:It's free for download but you have to pay... Read More
Microsoft Business Solutions Great Plains fits to majority of horizontal... Read More
There are certain pluses and minuses in both cases and... Read More
Adware is a type of Spyware program that displays some... Read More
Case study: A secretary using Corel WordPerfect 7 is often... Read More
Currently Microsoft Business Solutions is on the way of creating... Read More
Now there are Three Steps To Heaven Just listen and... Read More
There are several kinds of software piracy. The bottom line... Read More
Software |