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
recurring cleaning service Wilmette ..The intuitive algorithm.Roger Penrose considered it impossible. Thinking could never... Read More
XML Server can be a Web Server that stores the... Read More
In the real world a "fire wall" is a fireproof... Read More
Microsoft Great Plains is becoming more and more popular and... Read More
When you think... Read More
In the early days of the personal computer, we're talking... Read More
When you need a phone number, you do a quick... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
When my daughter was getting into AOL instant messaging (AIM)... Read More
In 2004 Oracle, Inc. made its new step toward J2EE... Read More
We'll give you non formal view, based on our consulting... Read More
There is many things more frustrating than surfing a website... Read More
Background: For many organizations like ours, the interim target of... Read More
In this small article we will show you the possible... Read More
Let's say that you have a software project that's under... Read More
Customer Relationship Management (CRM) is a strategy and processes used... Read More
Formatting and reinstalling windows 98 is very easy if you... Read More
Microsoft SQL Server is the leader for inexpensive and middle... Read More
I have yet to see a business that, sometimes in... Read More
Using professional icons in your application or website can bring... Read More
I have always had a tendency to focus on the... Read More
After almost two decades of existence, Quark has become the... Read More
The software giants don't do everything and don't always produce... Read More
Collaboration SoftwareCollaboration Software, also known as group collaboration software or... Read More
Table of Contents1) Introduction 2) Related Work 3) Framework 4)... Read More
reliable maid service Morton Grove ..Microsoft Outlook is one of the most widely used software... Read More
IBM Lotus Domino or Microsoft Exchange?The severe competition continues for... Read More
The major reason I recommend getting your hands on real... Read More
There are certain pluses and minuses in both cases and... Read More
Microsoft Great Plains is now targeting large and midsize businesses... Read More
Microsoft Business Solutions ? Navision is an integrated solution for... Read More
With so many Microsoft Windows related viruses, errors, and other... Read More
If you are to buy a HelpDesk & Asset Management... Read More
Our opinion is based on our Microsoft Business Solutions Great... Read More
The cornerstone of successful automated office systems is the ability... Read More
Microsoft Great Plains ? ERM from Microsoft Business Solutions and... Read More
.Net Framework is a platform or development environment to seamlessly... Read More
DBxtra goes ASPGetting to the information hidden within corporate databases... Read More
ERP Consulting industry is on the way to serve clients... Read More
Stop the Runaway MouseWhat's the "runaway mouse?" You've seen it...you... Read More
While several preventive maintenance software manufacturers offer free trials for... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Following tips help you to learn a software in lesser... Read More
Microsoft has never released a service pack for Windows98 SE,... Read More
Not all of us have the luxury of working both... Read More
A wiki is an editable text-based website. But you don't... Read More
Microsoft CRM is relatively new player on the now becoming... Read More
Microsoft Business Solutions Great Plains version 8.5, 8.0, 7.5, Great... Read More
Shareware has been fighting the stigma of being misunderstood for... Read More
It could just be me, but my experiences with document... Read More
Software |