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
monthly home cleaning Buffalo Grove ..When you visit department stores and see that majority of... Read More
The stakes are high when considering security, privacy, and savings,... Read More
Innovative Maintenance Systems (IMS) is one company that offers solutions... Read More
Some companies that are in need of fleet management may... Read More
It is now common thing when large corporation selects mid-market... Read More
Did you ever give a thought to the number of... Read More
Each Industry and market niche has business specific and unique... Read More
SAP Inc., a global leader in client/server enterprise application software... Read More
ERP is the acronym of Enterprise Resource Planning. Multi-module ERP... Read More
When it comes to running an office, the SOHO entrepreneur... Read More
Former Great Plains Software Dynamics/eEnterprise and currently Microsoft Business Solutions... Read More
Our hosted solution allow you to run your own search... Read More
Just stress testing one of the latest Linux distributions. Been... Read More
Shareware is software that you can try before you buy;... Read More
Many Webmasters have never bothered to view their website's server... Read More
How would you like to prevent spyware and adware from... Read More
When you think... Read More
Microsoft Great Plains is one of the Microsoft Business Solutions... Read More
Designing without tables by using CSS layouts is fast becoming... Read More
Table of Contents1) Introduction 2) Related Work 3) Framework 4)... Read More
Remember old good days when your company probably had Great... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
While I was preparing some personal background information for a... Read More
Microsoft Great Plains might be considered as ERP platform to... Read More
IBM Lotus Notes Domino and Microsoft CRM (Client Relation Management)... Read More
scheduled maid service Mundelein ..What is Software?Software is a set of instruction written to... Read More
Rapid Application Development (RAD) is a software development methodology. In... Read More
As we could imagine, if you are reading this article... Read More
XML Server can be a Web Server that stores the... Read More
Let's say that you have a software project that's under... Read More
Many reasons made GBM a unanimous choice for experts, one... Read More
In the previous ISDN article, we looked at how and... Read More
Have you noticed WordPerfect is gearing up for a comeback... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Sticky Noteshttp://www.deprice.com/stickynote.htmWith StickyNote 9.0, you can create beautiful 3D notes... Read More
Running Applications in Compatibility Mode With Windows XP, you can... Read More
Customer Relationship Management (CRM) is a strategy and processes used... Read More
ERP is the acronym of Enterprise Resource Planning. Multi-module ERP... Read More
Programming Help for BeginnersWe write programs to instruct computers. When... Read More
Microsoft Great Plains is main mid-market application from Microsoft Business... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics... Read More
Just stress testing one of the latest Linux distributions. Been... Read More
Microsoft Business Solutions Great Plains and MS CRM (client relation... Read More
With many manufacturing shops heading over seas in favor of... Read More
DBxtra goes ASPGetting to the information hidden within corporate databases... Read More
Sometimes your PC will start acting strange for no apparent... Read More
IntroductionDuring the early years of our modern computer era, very... Read More
There are plenty of articles out there about how to... Read More
Fleet Maintenance Management is a critical position in any company... Read More
Should one use Windows Update?This topic has good and valid... Read More
Software |