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
tidy up service Northbrook ..Just when you thought you were Web savvy, one more... Read More
If you are in the market for new staffing software,... Read More
This is a short article, written in question/answer/FAQ style to... Read More
Microsoft Business Solutions Small Business Manager is Great Plains Dexterity... Read More
In part III of this ISDN primer, we learned that... Read More
Stop the Runaway MouseWhat's the "runaway mouse?" You've seen it...you... Read More
Not every software testing project can or should be automated.... Read More
Current Microsoft Business Solutions Great Plains has more that 10... Read More
Considering whether or not your software company should hire a... Read More
Remember old good days when your company probably had Great... Read More
.NET platform does not support multiple inheritance. Do not confuse... Read More
It would be easy to think, like most people apparently... Read More
Microsoft Business Solutions Great Plains is very popular ERP/MRP applications... Read More
Microsoft Great Plains serves majority of US based horizontal and... Read More
Language development computer: Computer-based method for aiding language development seems... Read More
At the end of XX century, in the late 1990th... Read More
If you have Microsoft Great Plains as main accounting and... Read More
DBxtra goes ASPGetting to the information hidden within corporate databases... Read More
Software Engineering is the Systematic Approach for analysis design implementation... Read More
The first topic we are going to discuss... Read More
Just stress testing one of the latest Linux distributions. Been... Read More
Navision Software was purchased by Microsoft and now it is... Read More
One of the things we can be as certain of... Read More
If you have Microsoft Great Plains and support it for... Read More
With this small article we are continuing Microsoft Business Solutions... Read More
reliable home cleaners Buffalo Grove ..If you have Microsoft Great Plains and support it for... Read More
Microsoft Business Solutions Great Plains is mid and even corporate... Read More
TCO (Total Cost Ownership) is the buzzword in... Read More
Have you noticed WordPerfect is gearing up for a comeback... Read More
Costs of fleet maintenance software can vary widely. It is... Read More
The java programming language is becoming more and more popular... Read More
When making a decision to buy any piece of software... Read More
DBxtra goes ASPGetting to the information hidden within corporate databases... Read More
What is Colossus?Colossus is software licensed to about twenty-five insurance... Read More
Writing software manuals is boring, isn't it? We often think:... Read More
It's all about turn times in the eMedia industry! The... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Words we choose to describe things and phenomena often show... Read More
Our company, Novaprof Inc., developed unique software - DB Integration.... Read More
Microsoft Great Plains is main accounting / ERP application... Read More
GroupwareThe internet is full of 1.5 million to 7 million... Read More
Each Industry and market niche has business specific and unique... Read More
Just when you thought you were Web savvy, one more... Read More
Customer Relationship Management or CRM is a combination of enterprise... Read More
Microsoft Business Solutions Great Plains was designed back in the... Read More
FTP stands for "file transfer protocol". FTP is basically a... Read More
Microsoft Business Solutions Great Plains has substantial market share among... Read More
Hey Guys! Don't raise your eyebrows or fear by hearing... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
If there still are few unprotected computers left, I haven't... Read More
Software |