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
![]() |
|
![]() |
|
![]() |
|
![]() |
Before September of 1995, Microsoft ignored the Internet because their... Read More
The major reason I recommend getting your hands on real... Read More
Microsoft Office program is a programming tool called Visual Basic... Read More
Most computer users use spreadsheets software such as Microsoft Excel... Read More
Spyware is like the new technological nuclear weapon on the... Read More
How do you run a program on a remote server... Read More
Microsoft Great Plains might be considered as ERP platform to... Read More
Microsoft Great Plains, Navision, Solomon and Axapta are Microsoft Business... Read More
If you have Microsoft Great Plains and support it for... Read More
I've been active in the Cisco Certification track for four... Read More
ERP Consulting industry is on the way to serve clients... Read More
Now there are Three Steps To Heaven Just listen and... Read More
.NET platform does not support multiple inheritance. Do not confuse... Read More
If you company is small or mid-size special products or... Read More
Stop the Runaway MouseWhat's the "runaway mouse?" You've seen it...you... Read More
Microsoft CRM and IBM Lotus Notes Domino seem to be... Read More
This tutorial covers OLAP solutions used by Data warehouses and... Read More
Microsoft Business Solutions is emerging as very attractive vendor for... Read More
Microsoft Business Solutions Navision is main ERP application for European,... Read More
Document Management or Enterprise Information Management is perhaps one of... Read More
Microsoft Great Plains as ERP and Microsoft CRM as... Read More
Microsoft Business Solutions Great Plains, Navision, Axapta, Solomon and CRM... Read More
Does Microsoft care for WebmastersIt's always been a problem with... Read More
GroupwareThe internet is full of 1.5 million to 7 million... Read More
The various resume software offered, particularly on the internet, can... Read More
Sticky Noteshttp://www.deprice.com/stickynote.htmWith StickyNote 9.0, you can create beautiful 3D notes... Read More
When making a decision to buy any piece of software... Read More
When Windows fails to boot it is normally caused by... Read More
Just when you thought you were Web savvy, one more... Read More
I like my software simple. If it's too complex or... Read More
Have you ever noticed that when you look at your... Read More
Today's business world is fast-paced. No matter what it is... Read More
FTP stands for "file transfer protocol". FTP is basically a... 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
After seeing many people complain about their weak Internet security... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Heard about the Quark "killer"?Adobe InDesign CS2. Will it really... Read More
Now is the time to look at an alternative to... Read More
Microsoft Business Solutions Small Business Manager is Great Plains Dexterity... Read More
Crystal Reports is the most flexible tool on the market... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Innovative Maintenance Systems (IMS) is one company that offers solutions... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
So, you've bought a new Macintosh, and now you may... Read More
Bar charts, bar graphs, and any other chart or graph... Read More
Microsoft Business Solutions CRM data conversion deserves FAQ type of... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
Stop the Runaway MouseWhat's the "runaway mouse?" You've seen it...you... Read More
When Great Plains Software was designing and developing Great Plains... Read More
The major reason I recommend getting your hands on real... Read More
Today's business world is fast-paced. No matter what it is... Read More
Microsoft Retail Management (RMS) and Microsoft Great Plains are retail... Read More
The fact that a software tester is a most infamous... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
In our small article we'll consider Microsoft Business Solutions Great... Read More
#5 All your hardware components like Printers, PCs etc come... Read More
Background: For many organizations like ours, the interim target of... Read More
In the real world a "fire wall" is a fireproof... Read More
The Software 2005 conference is now a wrap. This conference,... Read More
The term "document management" and "paperless office" is the subject... Read More
Microsoft Business Solutions Great Plains serves multiple industries in the... Read More
While Ukraine is becoming a new popular IT outsourcing destination,... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics/eEnterprise... Read More
Microsoft Retail Management System serves retail single store as well... Read More
Passwords protect your most sensitive personal, financial and business information.... Read More
Software |