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
eco-friendly cleaning service Buffalo Grove ..While Adobe is the most known maker of PDF tools,... Read More
Research bears that less than 70 percent of development projects... Read More
Microsoft Business Solutions CRM is web-based CRM application, deploying all... Read More
Microsoft Business Solutions Great Plains has substantial market share and... Read More
If you have Microsoft Great Plains and support it... Read More
(1) Avoid using the same variable again and again for... Read More
Just imagine: you are walking, say, towards your car, and... Read More
As we could imagine, if you are reading this article... Read More
Case study: A secretary using Corel WordPerfect 7 is often... Read More
Microsoft Business Solutions CRM is present several years on the... Read More
Did you ever want to erase everything on your computer?... Read More
We don't think about mainframe software pricing anymore, we just... Read More
There are certain pluses and minuses in both cases and... Read More
Microsoft Business Solutions CRM proved to be reliable solution in... Read More
Background: For many organizations like ours, the interim target of... Read More
Mapping Software Improves Data VisualizationFrom the outset, it is important... Read More
Microsoft Business Solutions Great Plains is written in Great Plains... Read More
If your company has regional and worldwide operations, you might... Read More
I love new technology. I am still ready to wait... Read More
Microsoft Business Solutions products: Great Plains, MS CRM, Navision, Axapta,... Read More
The Windows registry is a huge database that ensures normal... Read More
Most people don't use Photoshop to its fullest capabilities. Here... Read More
Are you a whiz at calculating financial information? Not the... Read More
After seeing many people complain about their weak Internet security... Read More
Microsoft Great Plains serves the wide spectrum of horizontal markets.... Read More
express cleaning service Arlington Heights ..Mapping Software Improves Data VisualizationFrom the outset, it is important... Read More
Now that spyware is the single most dangerous threat to... 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
Microsoft Great Plains ? ERM from Microsoft Business Solutions and... Read More
Microsoft Great Plains, Navision, Solomon and Axapta are Microsoft Business... Read More
Using professional icons in your application or website can bring... Read More
Microsoft Business Solutions Great Plains has full-featured manufacturing set of... Read More
It could just be me, but my experiences with document... Read More
Intro This concise article will tell you in plain English... Read More
Running Applications in Compatibility Mode With Windows XP, you can... Read More
The COSMIC FP (function point) software quality metric, is no... Read More
Learning how to program software seems like a daunting task... Read More
Introduction to C++Why Learn C++?C++ may at first seem like... Read More
Document Manager and Version HistoryIn previous articles I have discussed... Read More
Many reasons made GBM a unanimous choice for experts, one... Read More
Great Plains Fixed Assets Management module is a robust tool... Read More
While paper labeling CDs and DVDs may appear to be... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Microsoft Great Plains is main accounting / ERP application... Read More
Microsoft Great Plains serves the wide spectrum of horizontal markets.... Read More
Microsoft Business Solutions Navision is main ERP application for European,... Read More
There are so many different programs that clutter up your... Read More
It is possible that if one avoided all sources of... Read More
Microsoft Business Solutions CRM data conversion deserves FAQ type of... Read More
Software |