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
housekeepers near Buffalo Grove ..I love new technology. I am still ready to wait... Read More
The first topic we are going to discuss... Read More
Microsoft Business Solutions Great Plains is written in Great Plains... Read More
Running Applications in Compatibility Mode With Windows XP, you can... Read More
IBM Lotus Notes Domino and Microsoft CRM (Client Relation Management)... Read More
Whether you have used Microsoft Word for years, have just... Read More
Sticky Noteshttp://www.deprice.com/stickynote.htmWith StickyNote 9.0, you can create beautiful 3D notes... Read More
This is a short article, written in question/answer/FAQ style to... Read More
Once upon a time not so long ago, there was... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
GroupwareThe internet is full of 1.5 million to 7 million... Read More
Formatting and reinstalling windows 98 is very easy if you... Read More
Microsoft Great Plains ? ERM from Microsoft Business Solutions and... Read More
Pirated software is on the increase and now accounts for... Read More
Fleet Maintenance Management is a critical position in any company... Read More
Microsoft Great Plains may be recommended for international freight forwarding... Read More
DBxtra goes ASPGetting to the information hidden within corporate databases... Read More
A UNIX Shell is in simplest terms, a command line... Read More
Great Plains Software Dynamics, Dynamics C/S+, eEnterprise were written on... Read More
Did you ever want to erase everything on your computer?... Read More
Lotus Notes Domino is very efficient in electronic document workflow... Read More
Several software companies design programs for preventive maintenance. Most of... Read More
Microsoft Business Solutions Navision serves both European and American megamarkets.... Read More
The purpose of Project Management Software is to provide an... Read More
As seeing large number of implementations ? in our case... Read More
custom home cleaning Mundelein ..When it comes to screenplay software each screenwriter needs to... Read More
If you are software developer or database administrator - we... Read More
Adware is a type of Spyware program that displays some... Read More
For a windows user like me, just can watch with... Read More
Whether you have used Microsoft Word for years, have just... Read More
As we could imagine, if you are reading this article... Read More
Manufacturing in the USA is far away down from mid... Read More
Usually, the easiest way to tell you have spyware is... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Several years ago Microsoft purchased Great Plains Software, then Navision... Read More
If you company is small or mid-size special products or... Read More
We live in a post-industrial age where information is the... Read More
Microsoft Great Plains serves majority of US based horizontal and... Read More
Microsoft Business Solutions Navision is main ERP application for European,... Read More
During the years of our consulting practice, which comes back... Read More
Microsoft Great Plains - Microsoft Business Solutions accounting and ERP... Read More
Microsoft Great Plains might be considered as ERP platform to... Read More
Trying to figure out a stream in banning one email... Read More
Once upon a time not so long ago, there was... Read More
Upgrading. Downtime. Maintenance. Hardware obsolescence. Implementation issues. The litany of... Read More
IntroductionSurprised, by the title? well, this is a tour of... Read More
The purpose of one of our projects was MS Exchange... Read More
When reading an article where some term is used often,... Read More
Your computer cost you from hundreds to thousands of dollars,... Read More
Are you one of those people that keeps track of... Read More
Software |