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
move out cleaning service Glencoe ..Most people don't use Photoshop to its fullest capabilities. Here... Read More
Well, even if the combination might look very unusual, we... Read More
You turn on your computer, and it doesn't look quite... Read More
All of us know that Microsoft bought former Great Plains... Read More
Microsoft Great Plains has full-featured Manufacturing suite of modules: Capacity... Read More
Microsoft Business Solutions Great Plains is very generic accounting application... Read More
Did you ever give a thought to the number of... Read More
Microsoft Great Plains, former Great Plains Software Dynamics, eEnterprise has... Read More
Microsoft Great Plains, former Great Plains Software Dynamics / eEnterprise... Read More
Introduction to C++Why Learn C++?C++ may at first seem like... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
ERP (Enterprise Resource Planning) Overview covers What is ERP, Brief... Read More
Program Flow is what you think it is. How the... 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
We'll give you non formal view, based on our consulting... Read More
Software development is a risky business.Many software developers are barely... Read More
Small can be beautiful! Working with Knoppix for the past... Read More
Microsoft Business Solutions Great Plains has Project Accounting module where... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
If you would like to pick something from Microsoft, or... Read More
While Ukraine is becoming a new popular IT outsourcing destination,... Read More
Microsoft Business Solutions Great Plains has I'd say end user... Read More
Find out why Spyware Removal from computers is important and... Read More
It could just be me, but my experiences with document... Read More
house cleaning company Bannockburn ..Navision Software was purchased by Microsoft and now it is... Read More
With so many Microsoft Windows related viruses, errors, and other... Read More
An operating system (abbreviated OS) is essentially the path through... Read More
Microsoft Business Solutions Great Plains serves multiple industries in the... Read More
This article is the first of a series of articles... Read More
A wiki is an editable text-based website. But you don't... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics... Read More
Microsoft Great Plains is becoming more and more popular and... Read More
Whether you are an experienced web programmer or a complete... Read More
If you're online using a dialup Internet connection, you'll probably... Read More
The intuitive algorithm.Roger Penrose considered it impossible. Thinking could never... Read More
Several software companies design programs for preventive maintenance. Most of... Read More
Just imagine: you are walking, say, towards your car, and... Read More
The major reason I recommend getting your hands on real... Read More
When it comes to screenplay software each screenwriter needs to... Read More
When you need a phone number, you do a quick... Read More
As of now - Great Plains Dynamics/eEnterprise is transformed/renamed into... Read More
We would like to give you several situations, when you... Read More
It is a well known fact that Java as a... Read More
This tutorial covers OLAP solutions used by Data warehouses and... Read More
Some companies that are in need of fleet management may... Read More
Microsoft Business Solutions Great Plains is written in Great Plains... Read More
Hi, Guys,I believe a lot of programmers are trying to... Read More
As we could imagine, if you are reading this article... Read More
How many steps does it take you to locate and... Read More
Software |